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

Do not forward the Authentication header after 3xx #284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

book
Copy link

@book book commented Mar 2, 2018

The Authorization header is sent when retrying a query after a 401
response. Usually, a cookie is set, which holds the "authorized" status
of the agent.

If the query including the Authentication header is accepted
(i.e. authentication is valid), and the server sends a 3xx response
back, the original query is cloned, and some headers are removed.

The Authentication header must also be removed, otherwise the query
might fail again (with a 403), for example when the Location in
the 3xx response is a redirect to a different domain, in a different
authorization realm.

Actual debugging and fix by Sergey Belikov.

This should fix #131.

The `Authorization` header is sent when retrying a query after a `401`
response. Usually, a cookie is set, which holds the "authorized" status
of the agent.

If the query including the `Authentication` header is accepted
(i.e. authentication is valid), and the server sends a `3xx` response
back, the original query is cloned, and some headers are removed.

The `Authentication` header must also be removed, otherwise the query
might fail again (with a `403`), for example when the `Location` in
the `3xx` response is a redirect to a different domain, in a different
authorization realm.

Actual debugging and fix by Sergey Belikov.

This should fix libwww-perl#131.
@oalders
Copy link
Member

oalders commented Mar 2, 2018

LGTM

@coveralls
Copy link

Coverage Status

Coverage remained the same at 69.258% when pulling 03ed4ac on book:patch-1 into c3e5eb2 on libwww-perl:master.

@oalders
Copy link
Member

oalders commented Mar 2, 2018

Should we add a regression test?

@vanHoesel
Copy link
Member

The change looks clean to me, but I would love to see either RFC that validates this change or have some more test run on modules that depend on us.

otherwise the query might fail again ...

might or will or only when it rains ?

Can we have some downstream integration test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LWP should recalculate digest auth after redirects [rt.cpan.org #24711]
4 participants