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

net/http: redirect should requires Location header #51345

Closed
yywing opened this issue Feb 24, 2022 · 4 comments
Closed

net/http: redirect should requires Location header #51345

yywing opened this issue Feb 24, 2022 · 4 comments

Comments

@yywing
Copy link

yywing commented Feb 24, 2022

When get a http response with status 302 and no Location Header

  1. call redirectBehavior get shouldRedirect true https://github.com/golang/go/blob/master/src/net/http/client.go#L738
  2. build next request ,and check Location Header https://github.com/golang/go/blob/master/src/net/http/client.go#L645
  3. call CheckRedirect

It should be:

  1. call redirectBehavior get shouldRedirect true
  2. call CheckRedirect
  3. build next request ,and check Location Header https://github.com/golang/go/blob/master/src/net/http/client.go#L645
@mengzhuo mengzhuo changed the title affected/package: net/http when no redict also err with 302 response missing Location header net/http: invalid CheckRedirect after missing Location header Feb 24, 2022
@mengzhuo
Copy link
Contributor

Please fulfill the Go issue template, thanks.

@mengzhuo mengzhuo added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 24, 2022
@mengzhuo
Copy link
Contributor

After reading the xray#1493 I think the title should be
redirect should requires Location header

And keeping same logic with 307/308

if resp.Header.Get("Location") == "" {
		shouldRedirect = false
}

Kindly cc @neild for comfirm

@mengzhuo mengzhuo changed the title net/http: invalid CheckRedirect after missing Location header net/http: redirect should requires Location header Feb 24, 2022
@mengzhuo mengzhuo added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 24, 2022
@seankhliao
Copy link
Member

related #49281

@mengzhuo
Copy link
Contributor

Thanks.
Duplicated with #49281

@mengzhuo mengzhuo removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Feb 25, 2022
@golang golang locked and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants