MCPcopy
hub / github.com/coyove/goflyway / replyGood

Method replyGood

proxy/server.go:128–144  ·  view source on GitHub ↗
(downstreamConn net.Conn, cr *clientRequest, ioc *IOConfig, r *http.Request)

Source from the content-addressed store, hash-verified

126}
127
128func (proxy *ProxyServer) replyGood(downstreamConn net.Conn, cr *clientRequest, ioc *IOConfig, r *http.Request) {
129 var p buffer
130 if cr.Opt.IsSet(doWebSocket) {
131 ioc.WSCtrl = wsServer
132
133 var accept buffer
134 accept.Writes(r.Header.Get("Sec-WebSocket-Key"), "258EAFA5-E914-47DA-95CA-C5AB0DC85B11")
135
136 ans := sha1.Sum(accept.Bytes())
137 p.Writes("HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: upgrade\r\nSec-WebSocket-Accept: ",
138 base64.StdEncoding.EncodeToString(ans[:]), "\r\n\r\n")
139 } else {
140 p.Writes("HTTP/1.1 200 OK\r\nContent-Type: application/octet-stream\r\nDate: ", time.Now().UTC().Format(time.RFC1123), "\r\n\r\n")
141 }
142
143 downstreamConn.Write(p.Bytes())
144}
145
146func (proxy *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
147 replySomething := func() {

Callers 1

ServeHTTPMethod · 0.95

Calls 4

WritesMethod · 0.95
IsSetMethod · 0.80
GetMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected