How to write http program through firewall???

pieter.claerhout at pandora.be pieter.claerhout at pandora.be
Fri Jan 4 11:12:56 EST 2002


I think there is a mixup in terminology here. It looks like you are not talking about a firewall here, but about a proxy server. If it's indeed a proxy server, you should set the http_proxy environment variable before running the script. Check the Python documentation for the correct syntax.

Cheers,


Pieter

------------------------
 =?gb2312?B?1cXJ2bPb <zhangsc at neusoft.com> wrote:
------------------------

>I have a question about httplib,I compile a program,it follows:
>import httplib
>conn = httplib.HTTPConnection("www.python.org")
>conn.request("GET", "/index.html")
>r1 = conn.getresponse()
>print r1.status, r1.reason
>data1 = r1.read()
>
>It raise a error:
>Traceback (most recent call last):
>  File "", line 3, in ?
>    conn.request("GET","/index.html")
>  File "D:\Python22\lib\httplib.py", line 523, in request
>    self._send_request(method, url, body, headers)
>  File "D:\Python22\lib\httplib.py", line 532, in _send_request
>    self.putrequest(method, url)
>  File "D:\Python22\lib\httplib.py", line 452, in putrequest
>    self.send(str)
>  File "D:\Python22\lib\httplib.py", line 394, in send
>    self.connect()
>  File "D:\Python22\lib\httplib.py", line 378, in connect
>    raise socket.error, msg
>error: (10060, 'Operation timed out')
>
>My computer's IP is 10.1.1.67,and my company's firewall is 10.1.1.105,and it's port is 3128,
>I can't communicate with www.python.org directly,  I only communicate with www.python.org through this 
>firewall of 10.1.1.105:3128. How can I correct above program and make it work again under firewall?
>Thanks!
>Edward
>
>
>
>
>
>
>
>
>I have a question about httplib,I compile a program,it 
>follows:
>import httplibconn = 
>httplib.HTTPConnection("www.python.org")conn.request("GET", "/index.html")r1 = 
>conn.getresponse()print r1.status, r1.reasondata1 = 
>r1.read()
>
>It raise a error:
>Traceback (most recent call 
>last): File "<pyshell#2>", line 3, in ? 
>conn.request("GET","/index.html") File "D:\Python22\lib\httplib.py", 
>line 523, in request self._send_request(method, url, body, 
>headers) File "D:\Python22\lib\httplib.py", line 532, in 
>_send_request self.putrequest(method, url) File 
>"D:\Python22\lib\httplib.py", line 452, in putrequest 
>self.send(str) File "D:\Python22\lib\httplib.py", line 394, in 
>send self.connect() File 
>"D:\Python22\lib\httplib.py", line 378, in connect raise 
>socket.error, msgerror: (10060, 'Operation timed out')
>
>My computer's IP is 10.1.1.67,and my company's firewall 
>is 10.1.1.105,and it's port is 3128,
>I can't communicate with www.python.orgdirectly, I only 
>communicate with www.python.org through this 
>
>firewall of 10.1.1.105:3128. How can I correct above 
>program and make it work again under firewall?
>Thanks!
>Edward
>
>






More information about the Python-list mailing list