From: guido at eric.cnri.reston.va.us (Guido van Rossum)
Date: 30 Apr 1999 00:38:04 -0400
Subject: Trouble with proxies
References: <7gasj8$g79$1@nnrp1.dejanews.com>
Message-ID: <5lzp3qafkj.fsf@eric.cnri.reston.va.us>
Content-Length: 2084
X-UID: 572                                                  

befletch at my-dejanews.com writes:

> I have tried all the suggestions people have sent me, and I have tried all
> the local debugging I could think of, but I still can't see the world from
> behind my proxy server.  Can anyone find a possible solution to this?  I've
> had to modify my URL lines with (colin-slash-slash) to get past DejaNews'
> Draconian posting filters:
> 
> C:\>SET http_proxy=http(colin-slash-slash)10.187.200.230
> 
> C:\>"C:\Program Files\Python\python.exe"
> Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import urllib
> >>> u=urllib.urlopen('http(colin-slash-slash)www.yahoo.com')
> Traceback (innermost last):
>   File "<stdin>", line 1, in ?
>   File "C:\Program Files\Python\Lib\urllib.py", line 59, in urlopen
>     return _urlopener.open(url)
>   File "C:\Program Files\Python\Lib\urllib.py", line 157, in open
>     return getattr(self, name)(url)
>   File "C:\Program Files\Python\Lib\urllib.py", line 266, in open_http
>     errcode, errmsg, headers = h.getreply()
>   File "C:\Program Files\Python\Lib\httplib.py", line 121, in getreply
>     line = self.file.readline()
>   File "C:\Program Files\Python\Lib\plat-win\socket.py", line 117, in readline
>     new = self._sock.recv(self._rbufsize)
> IOError: [Errno socket error] (10054, 'winsock error')
> >>>

A quick lookup in errno.errorcode shows that that error is
WSAECONNRESET, in other words the connection is reset by the server.
This apparently happens after the proxy has read your headers.  Could
it be that the proxy server requires some kind of magic header?  Ask
the sysadmin who is responsible for the proxy.  At least find out what 
the proxy software is, you can probably find the specs on the web....

If you have a way to snoop network packets, it would be interesting to
see what traffic happens when your regular browser (IE or netscape)
connects to the proxy from the same client machine (I'm assuming that
works!).

--Guido van Rossum (home page: http://www.python.org/~guido/)




