From: Daniel Finnie Date: 2008-04-19T23:44:43+09:00 Subject: Re: Webrick override HTTPResponse::setup_header Hi andrey, To clear out all of the existing headers you can use res.instance_variable_set("@header", {"header_name" => "header_value", "other_header_name" => "other_header_value"}) Dan On Sat, Apr 19, 2008 at 10:28 AM, Andrey Nikitin wrote: > В сообщении от 19 апреля 2008 18:10 Daniel Finnie написал(a): > > > Hi, > > > > Generally you should reply to the ruby-talk list instead of one > > particular person as someone on the list might have more knowledge of > > this subject. > Sorry. > > > > > > Are you sure that is the behavior of res["header"]? > > The source code does not look like it differentiates between pre-existing fields and > > new fields." > > -1- Webrick server responce without override HTTPResponse::setup_header() > > % nc localhost 60001 > HEAD /mjpeg.cgi HTTP/1.0 > > HTTP/1.1 200 > Connection: close > Date: Sat, 19 Apr 2008 14:21:33 GMT > Content-Type: text/html > Server: WEBrick/1.3.1 (Ruby/1.8.5/2006-08-25) > Content-Length: 285 > cOnTent-tYpE: My-idiotistic-uNsuppotred-Type > > > -2- full control on server response headers > > def do_GET(req, res) > class < def setup_header() > end > end # class > > res['cOnTent-tYpE'] = 'My-idiotistic-Type' > ... > end > > % nc localhost 60001 > HEAD /mjpeg.cgi HTTP/1.0 > > HTTP/1.1 200 > cOnTent-tYpE: My-idiotistic-uNsuppotred-Type > > > > >