-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix connect response that prevented proper working of websockets in FireFox #956
Conversation
When using http.Response.Write() the resulting payload contains additional Connection: close header. Firefox treats that proxy response as server response preventing proper working of a connect tunnel. Fixes #938
…sponses Add writeConnectOKResponse() and modify proxyConn.writeResponse() to use it.
if res.ContentLength != -1 { | ||
log.Errorf(ctx, "CONNECT response with Content-Length: %d, ignoring content length", res.ContentLength) | ||
res.ContentLength = -1 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't remove that. Even though, the proxy will now use raw bytes for connectOKResponse, It does not hurt us to keep this condition. That could print a useful log we are doing something wrong in some other place.
pc := proxyConn{ | ||
Proxy: p.Proxy, | ||
brw: brw, | ||
conn: conn, | ||
} | ||
pc.writeResponse(res) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, but it starts to look odd. Maybe there is some better way to share that code then 🤔.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks ok to me tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor suggestions
Fixes #938