Trouble with proxies

Bruce Fletcher befletch at my-dejanews.com
Fri Apr 30 17:07:21 EDT 1999


In article <7gd0dh$add$1 at nnrp1.dejanews.com>,
  befletch at my-dejanews.com wrote:
> In article <5lzp3qafkj.fsf at eric.cnri.reston.va.us>,
>   Guido van Rossum <guido at eric.cnri.reston.va.us> wrote:
> > 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!).
>
> The proxy server is WinProxy Lite, V2.1.  It is running on an NT4 server.
> Yes, IE and Netscape both work fine through the proxy server, and no, the
> sysadmin doesn't know anything more about WinProxy than how to install it
> and configure it for normal http/ftp/smtp/pop3 clients.
>
> Following suggestions from several kind people, I have also tried the
> following:

[snip]

Ok, I have expanded my test and come up with some interesting results.
I'm using IDLE now too, if that matters.  Slick program.  Anyway, consider
the following script:

 import os, urllib

 #os.environ['http_proxy'] = "http(colon-slash-slash)10.187.200.230:80/"
 #os.environ['http_proxy'] = "http(colon-slash-slash)1.2.3.4:5/"
 os.environ['http_proxy'] = ""
 # (colon-slash-slash) means :// but DejaNews won't post without the
 # translation.  Dunno why not.

 print os.environ['http_proxy']

 #f = urllib.urlopen('http://www.python.org/')
 #f = urllib.urlopen('http://www.nonexisting.site/')
 f = urllib.urlopen('http://www.ibm.com/')

 print f

 data = f.readline()

 while len(data)>0:
   print data
   data = f.readline()

No matter which proxy string I use, or which URL, I get the following:


 <addinfourl at 9536416 whose fp = <socket._fileobject instance at 916b20>>
 <HEAD><TITLE>403 Forbidden</TITLE></HEAD>

 <BODY><H1>403 Forbidden</H1>

 <P>The request was not properly formatted.  A possible security risk
 detected.</P>

 Traceback (innermost last):
  File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", line 131, in
 run_module_event
    execfile(filename, mod.__dict__)
  File "C:\Users\Bruce\postal codes\idle_experiment.py", line 19, in ?
    data = f.readline()
  File "C:\Program Files\Python\Lib\plat-win\socket.py", line 117, in readline
    new = self._sock.recv(self._rbufsize)
 error: (10054, 'winsock error')

It would appear that the proxy server isn't at issue.  Who is
generating that HTML output, anyway?

Thanks,
- Bruce

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




More information about the Python-list mailing list