[mod_python] return 200 vs return apache.OK ?

- troy troy at gci.net
Tue Aug 7 11:31:52 EST 2001


hi everyone!

i've been developing a project with mod_python for a few weeks, and 
i've run into a snag.  please forgive me if i'm not expressing this in 
the best terms; i'm new to python and apache both.

the problem i have is this:  whenever my handler returns an int by 
number, apache (or something) appends debugging information to the 
client response.  example handler:

	from mod_python import apache
	def handler(req):
		req.send_http_header()
		req.write('hello, world\n')
		return 200

on my system, this produces the following output:

	hello, world
	HTTP/1.1 200 OK
	Date: Tue, 07 Aug 2001 18:57:40 GMT
	Server: Apache/1.3.20 (Win32) mod_python/2.7.4 Python/2.1
	Keep-Alive: timeout=15, max=99
	Connection: Keep-Alive
	Transfer-Encoding: chunked
	Content-Type: text/html; charset=iso-8859-1

	<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
	<HTML><HEAD>
	<TITLE>200 OK</TITLE>
	</HEAD><BODY>
	<H1>OK</H1>
	The server encountered an internal error or
	misconfiguration and was unable to complete
	your request.<P>
	Please contact the server administrator,
	 <omitted> and inform them of the time the error occurred,
	and anything you might have done that may have
	caused the error.<P>
	More information about this error may be available
	in the server error log.<P>
	<HR>
	<ADDRESS>Apache/1.3.20 Server <omitted> Port 80</ADDRESS>
	</BODY></HTML>

there is nothing in the apache error log for these types of responses.

sometimes i can and do return the constant apache.OK, but i do need to 
return http codes as integers in some cases.  do i have something 
misconfigured?  am i missing the boat somehow?   what's the difference 
between returning 200 and apache.OK?

i have RTFM, but i'm  not the brightest bulb in the bunch.  any help 
would be appreciated.

-troy




More information about the Mod_python mailing list