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

go2:net/http.Client: Do not follow redirect by default! #42832

Closed
batara666 opened this issue Nov 25, 2020 · 5 comments
Closed

go2:net/http.Client: Do not follow redirect by default! #42832

batara666 opened this issue Nov 25, 2020 · 5 comments

Comments

@batara666
Copy link

batara666 commented Nov 25, 2020

Currently i use go1.15.3, Why net/http follow redirect by default ?, just why ?, It's a http client not a browser, cmon man, what are you thinking you should follow redirect in the first place ?

The Go I know are not like this, ~ Voltaire

This behavior confuse me for an hour, and I'm sure, I will use Go for the next 10years, or maybe 30years (if I still alive, or no robot/no code takes our job)

Aye mate, Don't just dislike, share your opinion too

@batara666
Copy link
Author

batara666 commented Nov 25, 2020

oh my gosh, I really feel like not using Go

Screenshot from 2020-11-26 00-28-31
And I just feel useless after knowing the google auto-complete

Sorry

@seankhliao
Copy link
Member

This is clearly documented and arguably useful behaviour for the majority of cases. As an HTTP client, it understands HTTP semantics such as redirects, authentication, etc.

From the package documentation, near the top (emphasis mine)

For control over HTTP client headers, redirect policy, and other settings, create a Client:

From https://golang.org/pkg/net/http/#Client 3rd paragraph

A Client is higher-level than a RoundTripper (such as Transport) and additionally handles HTTP details such as cookies and redirects.

[...3 more paragraphs on redirect policy...]

@batara666
Copy link
Author

batara666 commented Nov 25, 2020

cmon man, be real, no one read HTTP Client library behavior before they paste the code into their editor , so I go back Googling this kind of thing, and, Oh man, something wrong with our society, common sense are not always right, so we need to fix this weird behavior starting from Go 2 (and Python4)

@mvdan
Copy link
Member

mvdan commented Nov 25, 2020

The Go project doesn't use the issue tracker for questions. See https://golang.org/wiki/Questions.

If you really want to propose a change to the default behavior of net/http, you can create a proposal. But beware that there is currently no plan to make backwards-incompatible changes to standard library packages.

Also, remember to be respectful and thoughtful: https://golang.org/conduct.

@mvdan mvdan closed this as completed Nov 25, 2020
@mvdan
Copy link
Member

mvdan commented Nov 25, 2020

I just remembered that there's also this thread: #5465

@golang golang locked and limited conversation to collaborators Nov 25, 2021
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