-
-
Notifications
You must be signed in to change notification settings - Fork 226
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
amazonka-core: 304 is the only successful redirect response #835
Conversation
From brendanhay#755: > If you use the wrong region and do a simple S3 `GetObject`, then the > response is a 301 redirect. The problem is that this library treats > this as a successful response, and returns the AWS XML redirect page > as the response body! However, S3 returns 304 if a request matches the given ETag. Therefore, consider only 2xx and 304 responses as successful.
57d3886
to
f56e22f
Compare
@brendanhay @bitc @mgjpy3 @pbrisbin @cs @romanb @AriFordsham you may have opinions or further context on this, since you've raised bugs or discussed S3 response codes over the years. |
In my opinion, this is definitely an improvement, but I have two notes:
In any case, overall this is a 👍 from me, but I am interested to hear what others have to say about this PR. Thank you |
Re: Original bug: previous "fixes" have always been to It looks like @pbrisbin I am replying to your comment here to keep discussion in one place.
I think that these are correct.
This breaks the S3 client, because of #755 - S3 Also, the generator currently hardcodes the generation of the I think it is safe to generally consider 304s as successful, since you need to set some kind of header like The classification of status codes is already provided by Currently I'm weakly against adding generator-level knobs to generate different predicates because I think that this PR is likely to be enough. But I also want to let this discussion stew for a couple of days in case I'm wrong. |
I must be missing something because you lost me here. I thought the behavior on current
I think this is a totally valid criticism of my approach, and a good reason to just do something uniform all the time, whatever it is. |
What I think was desired by that change was to treat 304 as success for people who were trying to check cached content, and the 301 bug was an undesired consequence. |
I see! I hadn't seen that stated that clearly in any of the threads so far. Well, this PR seems perfect then. |
Nobody else has said anything, so I'll merge this now. I will be online for another 2–3 days and then unreachable for about a week. If you have objections, please raise them promptly. |
From #755:
However, S3 returns 304 if a request matches the given ETag. Therefore, consider only 2xx and 304 responses as successful.
Closes #755