Remove "Server:" header

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Oct 3 17:34:37 EDT 2008


En Fri, 03 Oct 2008 17:46:31 -0300, sebsauvage at gmail.com  
<sebsauvage at gmail.com> escribió:

> On 3 oct, 20:17, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
>> > sebsauv... 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 <g... 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)
>
> I see. No choice but to override the method with a copy of the
> source :-/
> I guess I'll have to do with that.

Another alternative would be to override send_header() and filter out the  
'Server' keyword...

-- 
Gabriel Genellina




More information about the Python-list mailing list