GET, HEAD, the Guillotine middleware extension

31 views
Skip to first unread message

Jens Troeger

unread,
Oct 18, 2019, 6:47:35 PM10/18/19
to pylons-discuss
Hello,

Today I stumbled upon a somewhat dated Pylons project called Guillotine, a WSGI middleware extension. It seems to have only one purpose: rewrite the request method of HEAD requests into GET.

Now I am curious about the why. A HEAD request is, as per documentation, pretty much a GET without body. So what’s the purpose then of this particular extension and the rewrite?

Much thanks,
Jens

Bert JW Regeer

unread,
Oct 20, 2019, 5:46:11 PM10/20/19
to Pylons Project
If your WSGI application for instance does not natively support HEAD requests, because it only handles GET requests, you can use this middleware to do the rewrite, have your WSGI app return the whole response, and Guillotine will then return a body less response to the remote client.

Bert

--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/cd9466d9-47ce-410f-9b36-5a47417cf8f2%40googlegroups.com.

Michael Merickel

unread,
Oct 21, 2019, 5:51:36 PM10/21/19
to Pylons
It's worth pointing out that while WSGI apps in general have that issue, webob (and thus pyramid apps) automatically handle this.

1) webob automatically truncates the body on a head request.
2) pyramid automatically configures any view that takes `request_method='GET'` to also take HEAD and documents that it does that.

- Michael



--

Michael
Reply all
Reply to author
Forward
0 new messages