Python 2.0.1 bug?

Steve Holden sholden at holdenweb.com
Fri Jul 20 10:39:50 EDT 2001


I saw a bug relating to CGIHTTPServer posted about anomalous behavior of IE
on Windows 2000, and noted that it also occurred on my Win98 system. POSTs
are even weirder: POST, POST, GET is the typical sequence of requests I see.
Appears to be a socket programming anomaly, I wonder if you could be hitting
the same thing?.

http://sourceforge.net/tracker/index.php?func=detail&aid=430160&group_id=547
0&atid=105470

regards
 Steve
--
http://www.holdenweb.com/


"TheDustbustr" <thedustbustr at aol.com> wrote in message
news:20010720095330.19318.00000287 at ng-fn1.aol.com...
> Sutdy the following code:
>
> # BEGIN CODE BLOCK
> # simple webserver
> import socket
>
> HOST = ''     # empty string meaning localhost
> PORT = 8080
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.bind((HOST, PORT))
> s.listen(1)
>
> while 1:
>     conn, addr = s.accept()
>     print 'Connected by', addr
>     data = conn.recv(1024)
>     print data
>     conn.send(data)     # reference point 1
>     conn.close()
> # END CODE BLOCK
>
> When you run this program then point your webbrowser to localhost:8080,
you
> SHOULD see your GET / HTTP/1.1 request echoed to the screen (the
"webpage"), as
> well as echoed to the console.  Well, under Python 1.5.2 running under
Linux,
> it does.  Running 2.0.1 under Windows 95, it doesn't, *nothing* is printed
to
> the webbrowser.  Reference point 1 can be changed to thus to make it work:
> conn.send(data+data)   Thus under Windows Py2.0.1 it prints the GET
request to
> the webbrowser ONCE.  Under Linux Py1.5.2 it prints it TWICE as expected).
> Another test with curious results is to change the reference line to this:
> conn.send("first part" + data + "second part")   This prints the string
"second
> part" to the webbrowser, nothing more.
>
> Hmmm, any known workarounds for this problem?  Other python-based servers
have
> worked on my machine (like the samples included in the docs).
>
> Thanks, Dustin





More information about the Python-list mailing list