Chromium Code Reviews| 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 |