Removing http headers

Hi All,

I hope you can help me, I need to remove the http headers an action
sends as response, and haven’t been able to find how.

A normal http response would have the following headers:

Cache-Control no-cache
Connection Keep-Alive
Date Mon, 22 Oct 2007 19:47:01 GMT
Content-Type text/html; charset=utf-8; charset=utf-8
Server WEBrick/1.3.1 (Ruby/1.8.6/2007-03-13)
Content-Length 1
Set-Cookie first_session

If I add the line “@headers.clear” to the action, the Cache-Control
header dissapears:

Connection Keep-Alive
Date Mon, 22 Oct 2007 19:47:28 GMT
Content-Type text/html; charset=utf-8
Server WEBrick/1.3.1 (Ruby/1.8.6/2007-03-13)
Content-Length 1
Set-Cookie _first_session_id=fc6285470aa256fbcedad6ad200eb437; path=/

I also found that by disabling the session with “session :disabled =>
true” the Set-Cookie header is not sent:

Connection Keep-Alive
Date Mon, 22 Oct 2007 22:25:10 GMT
Content-Type text/html; charset=iso-8859-1
Server WEBrick/1.3.1 (Ruby/1.8.6/2007-03-13)
Content-Length 1

Now I need to remove the “Server”, “Date”, “Connection” and
“Content-Type” header.

The reason I am doing this is that I need to save as much bytes as
possible, as this request will be sent in a mobile environment, and each
byte sent is “expensive”. I am also in control of the client making the
request, so there won’t be trouble reading the answer.

Any clues?

Thank you,
Gepetto

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs