HTTP HEAD request results in a 500 response code
Reported by Leonard Chin | July 7th, 2009 @ 06:38 PM | in Release 0.4 - Fresh Mint And Ginger
Running curl -I (a HEAD request) on a limonade page will ALWAYS result in a 500.
This behavior can be quite misleading, and doesn't really make much sense.
See: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the HTTP headers in response to a HEAD request SHOULD be identical to the information sent in response to a GET request. This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is often used for testing hypertext links for validity, accessibility, and recent modification.
This occurs because HEAD is not in request_methods(), and because it is not matched to a dispatch_*() method.
One approach to fix this is to add head to request_methods(), and map HEAD requests to the corresponding dispatch_get(), BUT prevent output of a body. A shortcut would be just to respond with 404/200 depending on the existence of a route for GET as defined by a dispatch_*()
Comments and changes to this ticket
-
Fabrice Luraine July 8th, 2009 @ 10:30 AM
- Milestone set to Release 0.4 - Fresh Mint And Ginger
- Assigned user set to Fabrice Luraine
In the 0.4 branch, it will return a 501 Not Implemented.
I will try to fix that in this release, probably with your first solution.Thks
-
Fabrice Luraine July 31st, 2009 @ 06:44 PM
- State changed from new to resolved
(from [4a770ede5dc8aac85244a41f4f3f952c00484729]) Adding support for HEAD requests [#12 state:resolved] http://github.com/sofadesign/limonade/commit/4a770ede5dc8aac85244a4...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Limonade is a PHP micro-framework.
People watching this ticket
Referenced by
- 12 HTTP HEAD request results in a 500 response code (from [4a770ede5dc8aac85244a41f4f3f952c00484729]) Adding ...