Match any Connection header that contains the Upgrade token for websocke...

...ts
Can you extract it to a method at least?

> On Sep 17, 2014, at 2:59 PM, Jessica Forrester <notifications@github.com> wrote:
> 
> In pkg/apiserver/watch.go:
> 
> > @@ -75,7 +76,8 @@ func (h *WatchHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
> >  		// TODO: This is one watch per connection. We want to multiplex, so that
> >  		// multiple watches of the same thing don't create two watches downstream.
> >  		watchServer := &WatchServer{watching, h.codec}
> > -		if req.Header.Get("Connection") == "Upgrade" && req.Header.Get("Upgrade") == "websocket" {
> > +		containsUpgrade := regexp.MustCompile("(^|.*,\\s*)Upgrade($|\\s*,)")
> Only thing I can find is buried in go.net/websocket/hybi.go as part of ReadHandshake
> 
> https://code.google.com/p/go/source/browse/websocket/hybi.go?repo=net#471
> 
> which would require creating a hybiServerHandshaker which seems websocket impl specific so not sure we should really be calling that here. I also dont love the check being used in that as it only checks that the string contains "upgrade" which is not as accurate as checking for upgrade as a single token (like the regex is doing)
> 
> —
> Reply to this email directly or view it on GitHub.