[Nitro] HTTP verbs and headers

Lars Olsson lasso at lassoweb.se
Thu Apr 5 12:33:00 EDT 2007


I'm quite sure no current Nitro code is affected in any way by the 
current behaviour (returning 200 OK on all requests), it's just a 
question about how Nitro wants to intepret the HTTP spec(1). My original 
test case came about after reading some articles about REST (and 
WebDAV). I was curious about how Nitro handled stuff like PUT and DELETE.

Even if Nitro in its current form is heavily geared towards 'normal' 
browsing, there really is a lot of other stuff based on HTTP going on. 
Whether Nitro should support 'other stuff' than normal browsing is of 
course open to discussion.

> Yes, Nitro is responsible for that, as it would have to treat 'PUT'
> differently from 'POST', but not disallow 'POST' (like w3.org) on the
> spot.  Nitro would have to check for every action if the action
> 'accepts' post/put/get/head, which isn't really all too great (some meta-
> data would have to be used).

What do you mean by meta data? The HTTP verb is readily available from 
the web server (HttpRequest.request_method when using Webrick, I'm 
pretty sure Mongrel has something similar).

> So, that it just returns 200 for all is ok in my eyes.  (Unless there's
> an error in my reasoning here....)

It's OK depending on how you interpret the spec :) 200 OK means that the 
request was accepted and processed acording to the spec. Since this 
isn't the case, Nitro is lying to the client connecting to the server.

My suggestion is to reject all HTTP verbs other than GET and POST
(405 Method Not Allowed) until (if ever) Nitro has the capabilty to 
respond to other verbs.



(1) The spec I keep rambling on about can be found at: 

More information about the Nitro-general mailing list