mirror of
https://github.com/yudai/gotty.git
synced 2026-01-01 07:08:49 +01:00
Refactor
This commit is contained in:
parent
54403dd678
commit
a6133f34b7
54 changed files with 2140 additions and 1334 deletions
23
server/log_response_writer.go
Normal file
23
server/log_response_writer.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type logResponseWriter struct {
|
||||
http.ResponseWriter
|
||||
status int
|
||||
}
|
||||
|
||||
func (w *logResponseWriter) WriteHeader(status int) {
|
||||
w.status = status
|
||||
w.ResponseWriter.WriteHeader(status)
|
||||
}
|
||||
|
||||
func (w *logResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
hj, _ := w.ResponseWriter.(http.Hijacker)
|
||||
w.status = http.StatusSwitchingProtocols
|
||||
return hj.Hijack()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue