472,794 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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 5434
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: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.