forked from mirror/gin
Referencing the http.Hijacker interface
This commit is contained in:
parent
4a24c47a69
commit
7a87c5cbd4
|
@ -11,10 +11,10 @@ import (
|
||||||
type (
|
type (
|
||||||
ResponseWriter interface {
|
ResponseWriter interface {
|
||||||
http.ResponseWriter
|
http.ResponseWriter
|
||||||
|
http.Hijacker
|
||||||
Status() int
|
Status() int
|
||||||
Written() bool
|
Written() bool
|
||||||
WriteHeaderNow()
|
WriteHeaderNow()
|
||||||
Hijack() (net.Conn, *bufio.ReadWriter, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
responseWriter struct {
|
responseWriter struct {
|
||||||
|
@ -59,7 +59,7 @@ func (w *responseWriter) Written() bool {
|
||||||
return w.written
|
return w.written
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow connection hijacking
|
// Implements the http.Hijacker interface
|
||||||
func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||||
hijacker, ok := w.ResponseWriter.(http.Hijacker)
|
hijacker, ok := w.ResponseWriter.(http.Hijacker)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
Loading…
Reference in New Issue