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: Client should cache 301/308 redirect #29776

Open
gaillard opened this issue Jan 17, 2019 · 3 comments

Comments

@gaillard
Copy link

commented Jan 17, 2019

What version of Go are you using (go version)?

go1.11.1

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux amd64, android arm

What did you do?

Used http.Client for multiple calls against a url that returns 301 or 308.

What did you expect to see?

Second invocation to use a cached response from the first.

What did you see instead?

The first call before the Location is followed is always made.

Is there any reason this choice was made or has the logic just never been put in?

@agnivade

This comment has been minimized.

Copy link
Member

commented Jan 17, 2019

/cc @bradfitz

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jan 17, 2019

Never considered either way.

@bradfitz bradfitz added this to the Go1.13 milestone Jan 17, 2019

@rsc

This comment has been minimized.

Copy link
Contributor

commented May 1, 2019

The http.Client does no caching of responses at all. It's not just 301/308.

What is the context here? Is there a situation where this is causing problems? Also, if you are making the same request repeatedly, why is it problematic to be repeating the redirected call but not problematic to be repeating the final call?

@rsc rsc modified the milestones: Go1.13, Go1.14 May 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.