Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: tools/chrome_proxy/testserver/server.go

Issue 2206363002: Added integration test to Chrome Proxy to verify direct connection on remote site timeout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added integration test to Chrome Proxy to verify direct connection on remote site timeout Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/chrome_proxy/testserver/server.go
diff --git a/tools/chrome_proxy/testserver/server.go b/tools/chrome_proxy/testserver/server.go
index 698e45ce46d1c3cfc1e997ef4a4a604db4509729..3232f6dd96f3b5c8bd510e36510e0244edd254b6 100644
--- a/tools/chrome_proxy/testserver/server.go
+++ b/tools/chrome_proxy/testserver/server.go
@@ -35,12 +35,15 @@ import (
"net/http"
"os"
"strconv"
+ "strings"
+ "time"
)
func init() {
http.HandleFunc("/requestHeader", requestHeader)
http.HandleFunc("/resource", resource)
http.HandleFunc("/default", defaultResponse)
+ http.HandleFunc("/blackhole", blackholeProxy)
}
// requestHander returns request headers in response body as text.
@@ -82,6 +85,18 @@ func defaultResponse(w http.ResponseWriter, r *http.Request) {
}
}
+// delay longer than 30s test failure threshold to any request coming from the
sclittle 2016/08/09 21:31:32 nit: looking at the rest of the file, it looks lik
Robert Ogden 2016/08/09 21:56:22 Done.
+// proxy, but respond immediately to any other request
+func blackholeProxy(w http.ResponseWriter, r *http.Request) {
+ if strings.Contains(r.Header.Get("via"), "Chrome-Compression-Proxy") {
+ // causes timeout on client, will then use direct instead
sclittle 2016/08/09 21:31:32 nit: Could you capitalize the first word in this s
Robert Ogden 2016/08/09 21:56:22 Done.
+ time.Sleep(60 * time.Second);
sclittle 2016/08/09 21:31:32 What is actually causing the bypass? Are you sure
Robert Ogden 2016/08/09 21:56:22 Done.
+ w.Write([]byte("You are proxy"));
+ } else {
+ w.Write([]byte("You are direct"));
+ }
+}
+
type override struct {
status int
header http.Header
« tools/chrome_proxy/testserver/app.yaml ('K') | « tools/chrome_proxy/testserver/app.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698