[BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Oct 3 20:17:35 CEST 2008


> sebsauvage at gmail.com wrote:
>> I'm using SimpleHTTPServer (work well) but it always sends "Server"
>> header in response:
>> How can I remove that ?

En Fri, 03 Oct 2008 11:11:34 -0300, Gary M. Josack <gary at byoteki.com>  
escribió:
> you've got ?self.send_header('Server', self.version_string()) in the  
> send_response method of the BaseHTTPRequestHandler class in the  
> BaseHTTPServer module. Long story, short, it's going to be a lot of work  
> to get rid of.

One can always write a customized RequestHandler, and just copy the  
send_response method omiting the offending line. (Ok, you have to check  
whether it still works with the next Python release... a warning triggered  
by a new sys.version would be enough to remember that)

-- 
Gabriel Genellina




More information about the Python-list mailing list