473,320 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

[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 5693
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael | last post by:
There seem to be two ways to include files on the server: 1. <!-- #include file="header.inc" --> 2. <script language="VBScript" runat="server" src="header.inc"></script> What are the differences...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
2
by: Lubomir | last post by:
Hi, I have a BoundColumn in a DataGrid: <asp:BoundColumn DataField="lastname" SortExpression="lastname" ReadOnly="True" HeaderText="Last Name"></asp:BoundColumn> Column is sorted. I am...
2
by: Miguel Dias Moura | last post by:
Hello, I have this line: <div runat="server" id="category-header"> I get this error: 'category-header' is not a valid identifier. When I use: <div runat="server" id="category-header">
3
by: ADavidson | last post by:
I'm getting a {"Parser Error: The Runat attribute must have the value Server." } error when I try to get the Server.GetlastError() in the Global.asax codebehind. Why am I getting this? I...
3
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005...
7
by: DC | last post by:
Hi, there is a 500;13 page one can configure in the website properties, but ..Net Framework 1.1 also delivers the "server too busy" message sometimes and the IIS custom error page does not seem...
0
by: Danigan | last post by:
Is there a way I can set up Apache to put incoming emails into a folder as individual text files (MIME, text, or I guess it'd be cool if Apache has a module to throw it into a database like mySQL...
19
by: Scott M. | last post by:
Why do we need runat="server" on our <headtags?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.