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:
parent
383a04f4c2
commit
1e57587fe9
13
router.go
13
router.go
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user