Skip to content
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

preserve exact header casing when using httpupgrade #3427

Merged
merged 4 commits into from
Jun 6, 2024

Conversation

mmmray
Copy link
Collaborator

@mmmray mmmray commented Jun 5, 2024

fix #3426

}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

gofmt, i don't know

First bool
}

func (c *ConnRF) Read(b []byte) (int, error) {
if c.First {
c.First = false
// TODO The bufio usage here is unreliable
resp, err := http.ReadResponse(bufio.NewReader(c.Conn), c.Req) // nolint:bodyclose
resp, err := http.ReadResponse(bufio.NewReader(c.Conn), nil) // nolint:bodyclose
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"If nil, a GET request is assumed."

https://pkg.go.dev/net/http#ReadResponse

@yuhan6665
Copy link
Member

Thanks for your quick pr! I think it is better to keep the original logic unless user has a custom header setting

@mmmray
Copy link
Collaborator Author

mmmray commented Jun 6, 2024

done. i feel that this adds complexity to the code, and requires more tests because there are more branches. i understand that there is an attempt to avoid regressions though.

@yuhan6665 yuhan6665 merged commit 980236f into XTLS:main Jun 6, 2024
33 of 34 checks passed
@mmmray
Copy link
Collaborator Author

mmmray commented Jun 6, 2024

it seems the tests on main branch are failing in a flaky+timeout way. i was debugging it but still could not figure out which test was broken 😅

@yuhan6665
Copy link
Member

This is annoying, may need to do a binary search to find the culprit..

@yuhan6665
Copy link
Member

Fangliding should do

@mmmray
Copy link
Collaborator Author

mmmray commented Jun 6, 2024

speculative fix: #3428

@Fangliding
Copy link
Member

I don't think we need to reduce code readability for a useless request

@Fangliding
Copy link
Member

I will write a simpler implementation later

@mmmray mmmray deleted the httpupgrade-preserve-header-casing branch June 6, 2024 09:44
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.

Some problems with httpupgrade headers
3 participants