parent
c5073d7a74
commit
6793e8ef1d
10
guard.go
10
guard.go
|
@ -1,7 +1,9 @@
|
||||||
package guard
|
package guard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -33,6 +35,14 @@ type responseWriter struct {
|
||||||
err string
|
err string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *responseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||||
|
h, ok := w.ResponseWriter.(http.Hijacker)
|
||||||
|
if !ok {
|
||||||
|
return nil, nil, errors.New("hijack not supported")
|
||||||
|
}
|
||||||
|
return h.Hijack()
|
||||||
|
}
|
||||||
|
|
||||||
func (w *responseWriter) WriteHeader(statusCode int) {
|
func (w *responseWriter) WriteHeader(statusCode int) {
|
||||||
if w.StatueCode != 0 {
|
if w.StatueCode != 0 {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue