Re: What should happen when you HEAD a CGI script?

robm@ncsa.uiuc.edu (Rob McCool)
Message-id: <9312200713.AA09201@void.ncsa.uiuc.edu>
From: robm@ncsa.uiuc.edu (Rob McCool)
Date: Mon, 20 Dec 1993 01:13:40 -0600
In-Reply-To: "Roy T. Fielding" <fielding@simplon.ICS.UCI.EDU>
       "What should happen when you HEAD a CGI script?" (Dec 18,  2:58am)
X-Mailer: Mail User's Shell (7.2.5 10/14/92)
To: "Roy T. Fielding" <fielding@simplon.ICS.UCI.EDU>, www-talk@www0.cern.ch
Subject: Re: What should happen when you HEAD a CGI script?
Content-Length: 1123
/*
 * What should happen when you HEAD a CGI script?  by "Roy T. Fielding" (fielding@simplon.ICS.UCI.EDU)
 *    written on Dec 18,  2:58am.
 *
 * While poking around in the NCSA httpd_1.0 source code, I noticed that
 * the CGI script interface does not treat the HEAD method differently
 * than the GET method.  Unlike the older htbin interface, performing a
 * 
 * HEAD /cgi-bin/script HTTP/1.0
 * 
 * will return exactly the same result (including body contents) as the
 * 
 * GET /cgi-bin/script HTTP/1.0
 * 
 * request.  There is no mention of HEAD responses in the initial CGI spec.
 * 
 * Is this just a simple oversight?  Or is it a feature?

Originally it was intended that scripts could check if REQUEST_METHOD is
HEAD, then they could perform the action themselves. However, the server
should probably limit their output in order to keep scripts small. I'll fix
it.

 * My preference would be for HEAD to check the existance, authorization,
 * and executability of the script and just return the response headers.
 * Am I missing something (besides sleep)?
 */

It wouldn't be able to return content-type.

--Rob