mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
http: add Hijacker type; remove Hijack from ResponseWriter
The Hijack functionality wasn't removed, but now you have
to test if your ResponseWriter is also a Hijacker:
func ServeHTTP(rw http.ResponseWriter, req *http.Request) {
if hj, ok := rw.(http.Hijacker); ok {
hj.Hijack(..)
}
}
R=rsc
CC=golang-dev
https://golang.org/cl/4245064
This commit is contained in:
parent
8b432848f4
commit
545a1eef6a
4 changed files with 6 additions and 12 deletions
|
|
@ -527,7 +527,7 @@ func (server *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||
io.WriteString(w, "405 must CONNECT\n")
|
||||
return
|
||||
}
|
||||
conn, _, err := w.Hijack()
|
||||
conn, _, err := w.(http.Hijacker).Hijack()
|
||||
if err != nil {
|
||||
log.Print("rpc hijacking ", w.RemoteAddr(), ": ", err.String())
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue