Skip to content

Provide full URL to proxies. #1060

merged 3 commits into from Dec 27, 2012

5 participants

Lukasa commented Dec 22, 2012

This resolves #1056 and #1058.

Lukasa commented Dec 22, 2012

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

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 

Then dispatch a request using requests:

import requests

s = requests.session()

s.proxies = {
    'http':  '',
    'https': '',

s.get('', verify=False)

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

Lukasa commented Dec 22, 2012

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

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__().
@Lukasa Lukasa Use full URL when contacting proxies.
Requests should use the full URL, not the path URL, when forwarding
traffic through proxies.
@Lukasa Lukasa Remove unneeded import. d675abb
Lukasa commented Dec 27, 2012

Rebased to allow automerging. =)


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.