473,799 Members | 3,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTTP Location: supported by HTTPServer?

I have a CGI server written in Python, useful for offline CGI testing.
One of my CGI scripts ends with:

print 'Location: http://myresourcelocat ion'
print

But this does not work with the Python CGI server...and the same
script *does* work via internet with the Apache server at my work.

Does the BaseHTTPServer. HTTPServer not support the HTTP Location
header or something like that?
From my Python CGI server program:

PORT = 8000

class Handler(CGIHTTP Server.CGIHTTPR equestHandler):
##
# Put subdirectories BEFORE their parent directories or else HTTP
# error 403 (no permission).
cgi_directories = ["/cgi-bin/mystuff", "/cgi-bin"]
##
# A hack for quiet mode: don't want messages (what IP reads what
# URL) to the console box
def log_message(sel f, *msg): pass

def serve():
httpd = BaseHTTPServer. HTTPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_for ever()

class CGIServer(threa ding.Thread):
def run(self): serve()
if __name__=='__ma in__':
CGIServer().sta rt()
Jul 18 '05 #1
0 1281

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1160
by: WmGill | last post by:
I'm new to Python, and am dabbling with it to replace a lot of scattered scripts & programs. One thing I want to try is an HTTPserver like in the pydocgui module. This way I can use html to create a user interface to an interactive script (i.e. for access to a MySQL db). Unfortunately, I get lost trying to follow a 2100 line script. Best I can figure tk provides the thread & loop to keep things running, but I'm not familiar enough...
2
11298
by: Gelo Ilzi | last post by:
I'm trying to implement a very simple http server with cgi functionality. The code is simple: import CGIHTTPServer, BaseHTTPServer httpd = BaseHTTPServer.HTTPServer(('',8000), CGIHTTPServer.CGIHTTPRequestHandler) httpd.serve_forever() I've created a subdir 'cgi-bin' which contains a python script. Now when I enter this directory, i.e., go to the url http://localhost:8000/cgi-bin/ my
1
2704
by: Erik Johnson | last post by:
Hi, I am trying to spawn a daemon type program to go off on its own and do some work (asynchoronously) from within an HTTPServer, but I am running into a problem where the web browser (actually a Perl LWP program) still seems to be waiting for more input until the child that is forked in the server finishes (granchild, actually). I don't understand this. I need to be able to have the POST to the server complete and go on even though...
0
1929
by: crowell | last post by:
Hello, I am having trouble getting the ThreadingMixIn to do what I want. Looking over the docs (and some old code I wrote which successfully does what I want), I arrived at the following: import time import SocketServer import BaseHTTPServer
6
6323
by: placid | last post by:
Hi all, Ive been reading about creating a HTTP server like the one pydoc creates (and studying pydoc source code). What i want to know, is it possible to create server that creates a webpage with hyperlinks that communicate back to the HTTP server, where each link accessed tells the server to execute some arbitrary command on local machine its running on? Cheers
0
1055
by: placid | last post by:
Hi all, Im having trouble with the following code for handling GET requests from a client to my HTTP server. What i want to do is restrict access only to a folder and contents(files) within this folder. But when trying to open files (eg text files) i get file not found error from send_head() method of SimpleHTTPServer. The reason behind this is when opening the file the path to the file is only C:\file.txt when it should be...
1
2565
by: placid | last post by:
Hi All, I have this BaseHTTPServer.HTTPServer that is located at C:\ (im on Windows XP), when i run the program (httpserver.pyw) from the Run Dialog as "C:\httpserver.pyw" the root folder ("\") for http server is C:\, but when i add an entry to Registry Run so that it runs at boot time, the root folder becomes "C:\Documents and Settings\<username>" ? Does anyone know what the problem is?
0
937
by: allavarapu | last post by:
Hi, I am new to Python and wrote a http protocol script. I got this error please slove this my server::: import string,cgi,time from os import curdir, sep
0
10488
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10029
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7567
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6808
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.