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..b8d9bf33a760406855ec2f4f9f8bd9eae8dfa802 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,19 @@ func defaultResponse(w http.ResponseWriter, r *http.Request) { |
| } |
| } |
| +// blackholePoxy delays longer than 90s test failure threshold to any request |
| +// coming from the proxy. Responds 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 proxy, will then send BLOCK_ONCE. |
| + // Appspot will 502 traffic at 120 seconds with no response. |
|
sclittle
2016/08/09 22:30:36
115 seconds seems pretty close to 120 seconds - pe
Robert Ogden
2016/08/09 22:44:54
Done.
|
| + time.Sleep(115 * time.Second); |
|
sclittle
2016/08/09 22:30:36
AIUI it's probably better to make the doc.ready ti
Robert Ogden
2016/08/09 22:44:54
Ah, that's a good point. I like that logic
|
| + w.Write([]byte("You are proxy")); |
| + } else { |
| + w.Write([]byte("You are direct")); |
| + } |
| +} |
| + |
| type override struct { |
| status int |
| header http.Header |