mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 03:21:29 +00:00
support Hijacker #428
This commit is contained in:
parent
383a04f4c2
commit
1e57587fe9
13
router.go
13
router.go
@ -1,7 +1,10 @@
|
|||||||
package beego
|
package beego
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@ -864,3 +867,13 @@ func (w *responseWriter) WriteHeader(code int) {
|
|||||||
w.started = true
|
w.started = true
|
||||||
w.writer.WriteHeader(code)
|
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()
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user