Skip to content

Provide full URL to proxies. #1060

Merged
merged 3 commits into from Dec 27, 2012

5 participants

@Lukasa
Collaborator
Lukasa commented Dec 22, 2012

This resolves #1056 and #1058.

@Lukasa
Collaborator
Lukasa commented Dec 22, 2012

I couldn't think of a good reproducible way to test this, but I'm open to ideas.

@leoluk
leoluk commented Dec 22, 2012

This is how you could reproduce it.

Set up a proxy (this one is very useful for debugging):

pip install mitmproxy

Run it:

mitmproxy -a 127.0.0.1 

Then dispatch a request using requests:

import requests

s = requests.session()

s.proxies = {
    'http':  '127.0.0.1:8080',
    'https': '127.0.0.1:8080',
}

s.get('http://google.de')
s.get('https://google.de', verify=False)

The current release results in error 400 (malformed request).

@Lukasa
Collaborator
Lukasa commented Dec 22, 2012

Bit much to ask of someone running the test suite though, surely?

@sigmavirus24
Collaborator
@vlaci
vlaci commented Dec 22, 2012

You could use the test server introduced in #982

Lukasa added some commits Dec 22, 2012
@Lukasa Lukasa PreparedRequests don't carry proxy information.
The proxy info appears to be carried on the session. The only remnants
of proxy handling are this line in __init__().
b479a62
@Lukasa Lukasa Use full URL when contacting proxies.
Requests should use the full URL, not the path URL, when forwarding
traffic through proxies.
702f403
@Lukasa Lukasa Remove unneeded import. d675abb
@Lukasa
Collaborator
Lukasa commented Dec 27, 2012

Rebased to allow automerging. =)

@kennethreitz
Owner

Looks good to me!

@kennethreitz kennethreitz merged commit 594716a into kennethreitz:master Dec 27, 2012
@Lukasa Lukasa deleted the Lukasa:proxy branch Dec 27, 2012
This was referenced Dec 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.