Skip to content

martian: fix CONNECTs content length #808

Merged
mmatczuk merged 2 commits intomainfrom
hg/connect_details
May 21, 2024
Merged

martian: fix CONNECTs content length #808
mmatczuk merged 2 commits intomainfrom
hg/connect_details

Conversation

@Choraden
Copy link
Contributor

No description provided.


func shouldFlush(res *http.Response) bool {
if res.Request.Method == http.MethodHead {
if res.Request.Method == http.MethodHead || res.Request.Method == http.MethodConnect {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@mmatczuk
Copy link
Contributor

Good catch please add a test.

@Choraden Choraden force-pushed the hg/connect_details branch from 76223dc to a099f7f Compare May 21, 2024 13:10
Choraden added 2 commits May 21, 2024 15:15
'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.
@Choraden Choraden force-pushed the hg/connect_details branch from a099f7f to deee6ea Compare May 21, 2024 13:18
@Choraden
Copy link
Contributor Author

Tests were added.

@mmatczuk mmatczuk self-requested a review May 21, 2024 14:41
Copy link
Contributor

@mmatczuk mmatczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mmatczuk mmatczuk merged commit 6ac276e into main May 21, 2024
@mmatczuk mmatczuk deleted the hg/connect_details branch May 21, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants