AckConnection acks an HTTP connection by sending a switch protocols status code that enables the caller to upgrade to streams.
(tracePropagation string)
| 203 | // AckConnection acks an HTTP connection by sending a switch protocols status code that enables the caller to |
| 204 | // upgrade to streams. |
| 205 | func (h *HTTPResponseReadWriteAcker) AckConnection(tracePropagation string) error { |
| 206 | resp := &http.Response{ |
| 207 | Status: switchingProtocolText, |
| 208 | StatusCode: http.StatusSwitchingProtocols, |
| 209 | ContentLength: -1, |
| 210 | Header: http.Header{}, |
| 211 | } |
| 212 | |
| 213 | if secWebsocketKey := h.req.Header.Get("Sec-WebSocket-Key"); secWebsocketKey != "" { |
| 214 | resp.Header = websocket.NewResponseHeader(h.req) |
| 215 | } |
| 216 | |
| 217 | if tracePropagation != "" { |
| 218 | resp.Header.Add(tracing.CanonicalCloudflaredTracingHeader, tracePropagation) |
| 219 | } |
| 220 | |
| 221 | return h.w.WriteRespHeaders(resp.StatusCode, resp.Header) |
| 222 | } |
| 223 | |
| 224 | // localProxyConnection emulates an incoming connection to cloudflared as a net.Conn. |
| 225 | // Used when handling a "hijacked" connection from connection.ResponseWriter |
nothing calls this directly
no test coverage detected