1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 12:30:54 +00:00

support Hijacker #428

This commit is contained in:
astaxie 2013-12-31 20:47:48 +08:00
parent 383a04f4c2
commit 1e57587fe9

View File

@ -1,7 +1,10 @@
package beego
import (
"bufio"
"errors"
"fmt"
"net"
"net/http"
"net/url"
"os"
@ -864,3 +867,13 @@ func (w *responseWriter) WriteHeader(code int) {
w.started = true
w.writer.WriteHeader(code)
}
// hijacker for http
func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
hj, ok := w.writer.(http.Hijacker)
if !ok {
println("supported?")
return nil, nil, errors.New("webserver doesn't support hijacking")
}
return hj.Hijack()
}