Opened 12 months ago

Closed 2 months ago

#29125 closed defect (fixed)

Make websocket server tolerant of HTTP/2

Reported by: dcf Owned by: arlolra
Priority: Medium Milestone:
Component: Circumvention/Snowflake Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: #31028 Points:
Reviewer: Sponsor:

Description

The Snowflake websocket server, inherited from flash proxy, assumes that the incoming http.ResponseWriter implements the http.Hijacker interface, which HTTP/2 connections do not.

It causes a panic in the log when you connect to the server with e.g. curl:

2019/01/18 18:56:29 http2: panic serving X.X.X.X:YYYY: interface conversion: *http2.responseWriter is not http.Hijacker: missing method Hijack

I'm not sure if WebSocket connections from browsers use HTTP/2 yet or not, but in any case we should handle it gracefully.

My first inclination is to see if porting to gorilla/websocket fixes this and #28726.

Child Tickets

Change History (3)

comment:1 Changed 12 months ago by dcf

Component: - Select a componentObfuscation/Snowflake

comment:2 Changed 3 months ago by arlolra

Owner: set to arlolra
Parent ID: #31028
Status: newassigned

I'm not sure if WebSocket connections from browsers use HTTP/2 yet or not

This would only be used for secure WebSockets requests, and only if there is already an HTTP/2 connection where the server has already advertised support for WebSockets over HTTP/2 via the HTTP/2 SETTINGS parameter defined in the specification.

From https://www.chromestatus.com/feature/6251293127475200

but in any case we should handle it gracefully.

h, ok := w.(http.Hijacker)
if !ok {
	return u.returnError(w, r, http.StatusInternalServerError, "websocket: response does not implement http.Hijacker")
}

From https://github.com/gorilla/websocket/blob/7e9819d926e9f51e09eabe119b6d78f94e058c44/server.go#L173-L176

My first inclination is to see if porting to ​gorilla/websocket fixes this

Seems like it would ...

comment:3 Changed 2 months ago by arlolra

Resolution: fixed
Status: assignedclosed

Resolved in #31028

Note: See TracTickets for help on using tickets.