Hi all, I was playing with some simple HTTP CGI server code and discovered what I think may be a bug in CGIHTTPServer.CGIHTTPRequestHandler. A "GET" request without a leading '/' from a telnet session displays the CGI script rather than the script's output. If the request includes the leading '/', the script is run as expected. Is this a bug? Windows 2000 Python 2.4.3
<server> import os, sys, socket from BaseHTTPServer import HTTPServer from CGIHTTPServer import CGIHTTPRequestHandler os.chdir('docs') myip = '127.0.0.1' serv = HTTPServer((myip, 8000), CGIHTTPRequestHandler) serv.serve_forever() </server> <docs/cgi-bin/hello.py> print 'Content-type: text/html\n' print '<html><head><title>Hello</title></head>' print '<body><h1>Hello</h1></body></html>' </docs/cgi-bin/hello.py> Telnet without a leading '/' in the request displays the script: <telnet> telnet localhost 8000 GET cgi-bin/hello.py print 'Content-type: text/html\n' print '<html><head><title>Hello</title></head>' print '<body><h1>Hello</h1></body></html>' Connection to host lost. </telnet> Telnet with a leading '/' in the request runs the script: <telnet> telnet localhost 8000 GET /cgi-bin/hello.py Content-type: text/html <html><head><title>Hello</title></head> <body><h1>Hello</h 1></body></html> Connection to host lost. </telnet> -- SteveN ____________________________________________________________________________________ 8:00? 8:25? 8:40? Find a flick in no time with the Yahoo! Search movie showtime shortcut. http://tools.search.yahoo.com/shortcuts/#news _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor