| 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..0861fab3efd1f68246f1804a5ed5bbf8ac3a9320 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 90 seconds for proxied responses, in order to test if
|
| +// the proxy will timeout on the site. 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.
|
| + time.Sleep(90 * time.Second);
|
| + w.Write([]byte("You are proxy"));
|
| + } else {
|
| + w.Write([]byte("You are direct"));
|
| + }
|
| +}
|
| +
|
| type override struct {
|
| status int
|
| header http.Header
|
|
|