Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36099 > unrolled thread

Re: Missing something obvious with python-requests

Started byChris Angelico <rosuav@gmail.com>
First post2013-01-04 13:56 +1100
Last post2013-01-05 02:24 +1100
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Missing something obvious with python-requests Chris Angelico <rosuav@gmail.com> - 2013-01-04 13:56 +1100
    Re: Missing something obvious with python-requests Hans Mulder <hansmu@xs4all.nl> - 2013-01-04 16:00 +0100
      Re: Missing something obvious with python-requests Chris Angelico <rosuav@gmail.com> - 2013-01-05 02:24 +1100

#36099 — Re: Missing something obvious with python-requests

FromChris Angelico <rosuav@gmail.com>
Date2013-01-04 13:56 +1100
SubjectRe: Missing something obvious with python-requests
Message-ID<mailman.71.1357268216.2939.python-list@python.org>
On Fri, Jan 4, 2013 at 5:53 AM, Ray Cote
<rgacote@appropriatesolutions.com> wrote:
> proxies = {
>     'https': '192.168.24.25:8443',
>     'http': '192.168.24.25:8443', }
>
> a = requests.get('http://google.com/', proxies=proxies)
>
>
> When I look at the proxy log, I see a GET being performed -- when it should be a CONNECT.
> Does not matter if I try to get http or https google.com.

Not sure if it's related to your problem or not, but my understanding
of a non-SSL request through a proxy is that it'll be a GET request
(eg "GET http://google.com/ HTTP/1.0"). So the problem is only that
it's still doing GET requests when it's an https query (which is where
CONNECT is needed).

ChrisA

[toc] | [next] | [standalone]


#36109

FromHans Mulder <hansmu@xs4all.nl>
Date2013-01-04 16:00 +0100
Message-ID<50e6ee72$0$6932$e4fe514c@news2.news.xs4all.nl>
In reply to#36099
On 4/01/13 03:56:47, Chris Angelico wrote:
> On Fri, Jan 4, 2013 at 5:53 AM, Ray Cote
> <rgacote@appropriatesolutions.com> wrote:
>> proxies = {
>>     'https': '192.168.24.25:8443',
>>     'http': '192.168.24.25:8443', }
>>
>> a = requests.get('http://google.com/', proxies=proxies)
>>
>>
>> When I look at the proxy log, I see a GET being performed -- when it should be a CONNECT.
>> Does not matter if I try to get http or https google.com.

> Not sure if it's related to your problem or not, but my understanding
> of a non-SSL request through a proxy is that it'll be a GET request
> (eg "GET http://google.com/ HTTP/1.0"). So the problem is only that
> it's still doing GET requests when it's an https query (which is where
> CONNECT is needed).

It all depends on the proxy URL.

It the proxy URL is http://192.168.24.25/, then the client should send
GET requests to the proxy in both cases, and the proxy should send GET
or CONNECT to the origin server, depending on whether origin URL uses
SSL.

If the proxy URL is https://192.168.24.25/, then the client should send
CONNECT requests to the proxy, and the proxy should send GET or CONNECT
as appropriate.

Python-requests appears to implement only the first case.


Hope this helps,

-- HansM

[toc] | [prev] | [next] | [standalone]


#36110

FromChris Angelico <rosuav@gmail.com>
Date2013-01-05 02:24 +1100
Message-ID<mailman.84.1357313079.2939.python-list@python.org>
In reply to#36109
On Sat, Jan 5, 2013 at 2:00 AM, Hans Mulder <hansmu@xs4all.nl> wrote:
> It the proxy URL is http://192.168.24.25/, then the client should send
> GET requests to the proxy in both cases, and the proxy should send GET
> or CONNECT to the origin server, depending on whether origin URL uses
> SSL.
>
> If the proxy URL is https://192.168.24.25/, then the client should send
> CONNECT requests to the proxy, and the proxy should send GET or CONNECT
> as appropriate.

Are you sure? This seems backward. As I understand it, a GET request
to a proxy triggers a GET request to the origin server, and a CONNECT
request to a proxy triggers a TCP socket connection to the origin host
(which may not even be an HTTP/HTTPS server). This has nothing to do
with the protocol used between the client and the proxy.

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web