Merge branch 'master' into proxy/keepalive-directive

This commit is contained in:
Nimi Wariboko Jr
2016-08-05 16:20:37 -07:00
committed by GitHub
13 changed files with 250 additions and 72 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ type Upstream interface {
// The path this upstream host should be routed on
From() string
// Selects an upstream host to be routed to.
Select() *UpstreamHost
Select(*http.Request) *UpstreamHost
// Checks if subpath is not an ignored path
AllowedPath(string) bool
}
@@ -93,7 +93,7 @@ func (p Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
// hosts until timeout (or until we get a nil host).
start := time.Now()
for time.Now().Sub(start) < tryDuration {
host := upstream.Select()
host := upstream.Select(r)
if host == nil {
return http.StatusBadGateway, errUnreachable
}