You may find my blog post about GET/HEAD and WSGI interesting.

  http://blog.dscpl.com.au/2009/10/wsgi-issues-with-http-head-requests.html

Because of Python web frameworks doing all sort of odd things and not
always handling HEAD properly, I in part felt that WSGI adapters
should always just convert HEAD to GET as is safest thing to do to
ensure correct behaviour.

Graham

On Feb 3, 9:35 pm, Mike Burrows <[email protected]> wrote:
> When routes have conditions that constrain the request method to GET,
> any HEAD requests result in 405 Method Not Allowed.  Bug or feature?
>
> With HEAD added as an allowed method, the server (paster) does the
> right thing and returns a zero-length body.
>
> Working around this in one's routing isn't always an easy option -
> mapper.resource() or mapper.collection() don't add HEAD automatically,
> and they probably shouldn't either. Can't help thinking that somewhere
> in the middleware stack (before Routes I guess) a HEAD should be
> turned temporarily into GET so that HEAD is allowed everywhere GET
> is.  As such this feels to me a Pylons issue.  Before I raise a
> ticket, any thoughts?
>
> Small asides:
> (1) I haven't tested what happens if you use @restrict instead (I
> don't use it)
> (2) a head() method in paste.fixture would be nice, but in the
> meantime app._gen_request('HEAD', ...) does the job.  Tried real http
> requests using curl too.
>
> Regards,
> Mike

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to