2017-02-25 22:37:07 +00:00
|
|
|
package server
|
2015-09-20 04:41:24 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"net"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2017-02-25 22:37:07 +00:00
|
|
|
type logResponseWriter struct {
|
2015-09-20 04:41:24 +00:00
|
|
|
http.ResponseWriter
|
|
|
|
status int
|
|
|
|
}
|
|
|
|
|
2017-02-25 22:37:07 +00:00
|
|
|
func (w *logResponseWriter) WriteHeader(status int) {
|
2015-09-20 04:41:24 +00:00
|
|
|
w.status = status
|
|
|
|
w.ResponseWriter.WriteHeader(status)
|
|
|
|
}
|
|
|
|
|
2017-02-25 22:37:07 +00:00
|
|
|
func (w *logResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
2015-09-20 04:41:24 +00:00
|
|
|
hj, _ := w.ResponseWriter.(http.Hijacker)
|
|
|
|
w.status = http.StatusSwitchingProtocols
|
|
|
|
return hj.Hijack()
|
|
|
|
}
|