If all you're worried about is not sending content, I believe a lot of web servers will handle this for you. I have a few mod_perl servers (including masonhq.com) that don't do anything special for HEAD, and no content gets sent anyway, so I assume Apache is throwing away the content:
swartz> telnet masonhq.com 80 Trying 208.185.231.106... Connected to masonhq.com. Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.1 200 OK Date: Thu, 01 Oct 2009 17:58:39 GMT Server: Apache/1.3.33 (Unix) mod_perl/1.29 Content-Type: text/html X-Cache: MISS from www.masonhq.com Connection: close Connection closed by foreign host. Of course, this is wasting processing time, but that only matters if you are getting more than a trivial number of HEAD requests. Interestingly I just noticed the other day that Amazon returns a 405 on HEAD requests. I wonder if this is an oversight or a statement on the modern irrelevance of HEAD requests? swartz> HEAD http://www.amazon.com/ 405 MethodNotAllowed Jon On Oct 1, 2009, at 5:18 AM, Jérôme Etévé wrote: > Hi all, > > I'm wondering how to handle HEAD requests with mason. > The w3c states : "The HEAD method is identical to GET except that the > server MUST NOT return a message-body in the response." > > So I'd like to know if there's a way to just send the http headers and > skip the content with Mason, so a Mason site can be standard compliant > on this point. > > Would this code in my top level component (after any other call that > could modify the headers) be enough ?: > > if ( $ENV{'HTTP_METHOD'} eq 'HEAD' ){ > $m->clear_buffer() ; > $r->send_http_header() ; > $m->abort() ; > } > > > Thanks for any help! > > Jerome. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users