PycURL; Received HTTP 400 code from proxy after CONNECT

I use pycURL to make multiple requests to an https site through an http proxy.

Here is my code:

import pycurl
buf = cStringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, url) # 'url' is the base url of the form https://www.target.com
c.setopt(c.PROXY, proxy) # 'proxy' has the form 1.2.3.4:8080
c.setopt(c.WRITEFUNCTION, buf.write)
c.perform()  

I tried this code with different proxies. I get either Proxy CONNECT abortedor Received HTTP code 400 from proxy after CONNECT.

Is there something I am missing? Should I use https proxy instead? I looked around and cannot find any help or documentation on using pycURL.

Any help appreciated. Thank you

+4
source share

Source: https://habr.com/ru/post/1669074/


All Articles