Using BaseHTTPServer.BaseHTTPRequestHandler

Steve Purcell stephen_purcell at yahoo.com
Fri Jul 28 18:24:29 EDT 2000


Lars von Wedel wrote:
> 
> I have built a standalone HTTP server using the class
> BaseHTTPServer.BaseHTTPRequestHandler from which I derived
> my own handler.
>
> My problem is that when I print a header with a 'Content-type',
> the corresponding line appears in the browser client, so obviously
> somebody printed the header before. That way, I can only output html
> pages, which is not what I want. However, I cannot find any
> class involved that could cause this.


>From what I can see in the BaseHTTPServer code, it looks like you should be
using the 'send_header' method of BaseHTTPRequestHandler rather than just
printing out the header directly.

-Steve

-- 
Steve Purcell,  Technical Director, Inkontact
Get in touch at http://www.inkontact.com/
Get testing at http://pyunit.sourceforge.net/
"Life must be simple if I can do it" -- Me




More information about the Python-list mailing list