Questions tagged [cgihttprequesthandler]

9 questions
6
votes
3 answers

Python CGIHTTPServer Default Directories

I've got the following minimal code for a CGI-handling HTTP server, derived from several examples on the inner-tubes: #!/usr/bin/env python import BaseHTTPServer import CGIHTTPServer import cgitb; cgitb.enable() # Error reporting server =…
charleslparker
  • 1,904
  • 1
  • 21
  • 31
5
votes
4 answers

CGIHTTPRequestHandler run php or python script in python

I'm writing a simple python web-server on windows.. it works but now I want to run dynamic scripts (php or py) and not only html pages.. here is my code: from BaseHTTPServer import HTTPServer from CGIHTTPServer import CGIHTTPRequestHandler class…
frx08
  • 4,222
  • 8
  • 37
  • 45
1
vote
1 answer

How to make CGIHTTPRequestHandler execute my PHP scripts with POST data

I am currently trying to do simple web stuff with the http.server module in Python. When I try to POST a form to my script, it does not receive the POST data, $_POST ist empty and file_get_contents('php://input') as well. This is my…
Aaron H
  • 134
  • 10
1
vote
1 answer

Unable to run python cgi scripts using CGIHTTPRequestHandler in Python 3.3

I am a noob; trying to create and use a simple webserver in Python that executes CGI scripts written in Python. I am using Windows XP and Python v3.3.0. I have a "myserver" directory which contains "myserver.py","sample.html" and the directory…
Jazz
  • 639
  • 1
  • 11
  • 28
1
vote
0 answers

How can i find out names of uploaded files using 'CGIHTTPServer.CGIHTTPRequestHandler' do_POST?

query = cgi.parse_multipart(handler.rfile, pdict) I used function "parse_multipart" of module cgi to convert the form data, but i can not find the name of uploaded file in the content of variable "query"? where i can find the file's name. Thanks!
KimboQi
  • 107
  • 3
0
votes
1 answer

python basehttpserver and cgihttpserver do_GET(self), use cgi requesthandler and base requesthandler

class WebServer(SocketServer.ThreadingMixIn,BaseHTTPServer.HTTPServer): # Works with basehttphandler do_get(self): if 'home' in self.path: # "Working" Method is commented out. The problem I'm having…
0
votes
1 answer

Accessing POST request data from CGIHTTPServer (python)

I have a very simple CGI webserver running using python CGIHTTPServer class. This class spawns and executes a cgi-php script. If the webpage sends POST request, how can I access the POST request data in the php script?
Methos
  • 13,608
  • 11
  • 46
  • 49
0
votes
1 answer

CGI not working with built-in Python 3.1 http.server

I'm using http.server with the CGIHTTPRequestHandler on OS X 10.6 and the posix code path in run_cgi() does not appear to work properly. I'm calling a located at /cgi-bin/test.py from a form submit. For the better part of this afternoon I was…
Chris H
  • 1
  • 1
0
votes
1 answer

How to pre-process requests before handling them using BaseHTTPServer?

I want to deny access to certain paths on my server, which is using the CGIHttpServer module. I've come up with a whitelist that I'll need to check on every request, but my problem is how to implement it. I tried overriding the handle_one_request…
rvighne
  • 20,755
  • 11
  • 51
  • 73