468,121 Members | 1,447 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,121 developers. It's quick & easy.

[BaseHTTPServer/SimpleHTTPServer] Remove "Server:" header

Hello.
I'm using SimpleHTTPServer (work well) but it always sends "Server"
header in response:
"Server: SimpleHTTP/0.6 Python/2.5.1"

How can I remove that ?

I tried:
self.server_version = ""
self.sys_version = ""

but the header is still sent, empty.

I there a way to remove the "Server:" header completely ?

Thanks.
Oct 3 '08 #1
4 4341
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.

se********@gmail.com wrote:
Hello.
I'm using SimpleHTTPServer (work well) but it always sends "Server"
header in response:
"Server: SimpleHTTP/0.6 Python/2.5.1"

How can I remove that ?

I tried:
self.server_version = ""
self.sys_version = ""

but the header is still sent, empty.

I there a way to remove the "Server:" header completely ?

Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Oct 3 '08 #2
se********@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 <ga**@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

Oct 3 '08 #3
On 3 oct, 20:17, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
sebsauv...@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...@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.

Thanks.
Oct 3 '08 #4
En Fri, 03 Oct 2008 17:46:31 -0300, se********@gmail.com
<se********@gmail.comescribió:
On 3 oct, 20:17, "Gabriel Genellina" <gagsl-...@yahoo.com.arwrote:
sebsauv...@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...@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

Oct 3 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lubomir | last post: by
2 posts views Thread by Miguel Dias Moura | last post: by
3 posts views Thread by Jim in Arizona | last post: by
19 posts views Thread by Scott M. | last post: by
18 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.