SimpleHTTPServer, queries unhandled?

B

Bryan Rasmussen

Hey just doing some preliminary testing with SimpleHTTPServer, and i noticed
that when i request a resource with a query string parameters that this was not
handled.

is this correct, or is there a method to set query string handling?
 
S

Steve Holden

Bryan said:
Hey just doing some preliminary testing with SimpleHTTPServer, and i noticed
that when i request a resource with a query string parameters that this was not
handled.

is this correct, or is there a method to set query string handling?

Well, since SimpleHTTPServer doesn't implement CGIs, the only stuff it
can serve up is static content, which clearly can't use any query string
input anyway. You probably want CGIHTTPServer.

regards
Steve
 
K

Kartic

Try this in IDLE:

import CGIHTTPServer
CGIHTTPServer.test()

This starts serving right away. You can also look at CGIHTTPServer.py
in your Python/Lib to see how test() has been implemented.

test() starts serving from the current directory (of running python).
If you create a folder called cgi-bin and put a testcgi.py, this module
executes the .py file and displays the contents in the browser :)
Thanks,
--Kartic
PS: You can handle query strings accordingly now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,214
Messages
2,571,112
Members
47,706
Latest member
HFWTina07

Latest Threads

Top