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

Potential Typo in Request Handling - "r.Close" misset to False? #515

Open
tiaras12 opened this issue Nov 6, 2023 · 0 comments
Open

Potential Typo in Request Handling - "r.Close" misset to False? #515

tiaras12 opened this issue Nov 6, 2023 · 0 comments

Comments

@tiaras12
Copy link

tiaras12 commented Nov 6, 2023

goproxy/proxy.go

Lines 99 to 108 in 3ec0782

// When server reads http request it sets req.Close to true if
// "Connection" header contains "close".
// https://github.com/golang/go/blob/master/src/net/http/request.go#L1080
// Later, transfer.go adds "Connection: close" back when req.Close is true
// https://github.com/golang/go/blob/master/src/net/http/transfer.go#L275
// That's why tests that checks "Connection: close" removal fail
if r.Header.Get("Connection") == "close" {
r.Close = false
}
r.Header.Del("Connection")

It seems that req.Close should set to true when the "Connection" header contains "close" according the comment above.
However, in the above snippet, r.Close is being set to false. Is this a typo or I misunderstanding it

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

No branches or pull requests

1 participant