-
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
martian: fix CONNECTs content length #808
Conversation
internal/martian/flush.go
Outdated
@@ -23,7 +23,7 @@ import ( | |||
) | |||
|
|||
func shouldFlush(res *http.Response) bool { | |||
if res.Request.Method == http.MethodHead { | |||
if res.Request.Method == http.MethodHead || res.Request.Method == http.MethodConnect { |
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'm not sure this should be here.
Failed connect is free to return response as any other method.
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.
OK, I will drop that.
Good catch please add a test. |
76223dc
to
a099f7f
Compare
'Content-Length: 0' is not expected in the CONNECT response * Connected to localhost (::1) port 3128 * CONNECT tunnel: HTTP/1.1 negotiated * allocate connect buffer * Establish HTTP proxy tunnel to httpbin:8080 > CONNECT httpbin:8080 HTTP/1.1 > Host: httpbin:8080 > User-Agent: curl/8.4.0 > Proxy-Connection: Keep-Alive > < HTTP/1.1 200 OK < Content-Length: 0 * Ignoring Content-Length in CONNECT 200 response < * CONNECT phase completed * CONNECT tunnel established, response 200
Modify CONNECT response content length before it gets logged.
a099f7f
to
deee6ea
Compare
Tests were added. |
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
No description provided.