-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[client] 301 in POST gets redirected to GET #3082
Comments
The change was introduced by #157 (3.5 years ago). |
I've already worked around this for my use case so this is not really causing me any issues. Just notice that the behavior was not falling strictly under rfc and thought I'd report it. If the behavior is intentional or you prefer not to make any change feel free to close the issue :) |
The behavior follows |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
Using
aiohttp-client
to make aPOST
request, if the server responds with a301
the client makes a new request to the provided URI but the new request is an emptyGET
.Expected behaviour
According to
RFC2616-sec10.3.2
the method should not change. Emphasis on:Actual behaviour
According to
RFC1945-sec9.3
,RFC2068-sec10.3
andRFC2616-sec10.3
:Now, considering the in-code nature of
aiohttp-client
(i.e. it's not exactly an end-user user-agent) and the fact thataiohttp-client
provides an option to not follow redirects, one could argue that the above should not strictly apply.So, the way I see it there are two choices:
Maintain the HTTP method when redirecting (this is what happens for example when
aiohttp-client
gets a308
during aPOST
request)Do not redirect on any method other that
GET
andHEAD
(event if follow redirects isTrue
)Steps to reproduce
Using the following server - client pair
The client will print:
Indicating a Method Not Allowed (since it used GET on the resource)
and the server will print:
Indicating that after the first
POST
on the resource the client tried toGET
the resource returned by the server.Your environment
Ubuntu 17.10
aiohttp 3.3.1
The text was updated successfully, but these errors were encountered: