Skip to content
This repository has been archived by the owner on Jun 1, 2018. It is now read-only.

Preserve host header when modifying request path #123

Closed
wants to merge 1 commit into from
Closed

Preserve host header when modifying request path #123

wants to merge 1 commit into from

Conversation

fimad
Copy link

@fimad fimad commented Feb 15, 2016

Currently the path_components and query setters of the Request object
use the url setter under the hood. The url setter updates all parts of
the URL including the host. If the host header and the host in the
request URL are different (as is common when making HTTPS requests)
then the host header will be updated to the value in the URL as a
result of modifying the path.

This change fixes this problem by modifying the query and
path_components setters to not use the url setter and instead directly
update the path field.

Currently the path_components and query setters of the Request object
use the url setter under the hood. The url setter updates all parts of
the URL including the host. If the host header and the host in the
request URL are different (as is common when making HTTPS requests)
then the host header will be updated to the value in the URL as a
result of modifying the path.

This change fixes this problem by modifying the query and
path_components setters to not use the url setter and instead directly
update the path field.
@mhils
Copy link
Member

mhils commented Feb 15, 2016

Thanks, this is a good catch. We just finished moving netlib into the main mitmproxy repository to simplify our workflows. Can I ask you to re-submit the PR there? 😃

Thanks!
Max

@fimad
Copy link
Author

fimad commented Feb 16, 2016

Sure thing, moved to mitmproxy/mitmproxy#948

@fimad fimad closed this Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants