<div class="gmail_quote">On 20 September 2010 16:19, Robert Brewer <span dir="ltr">&lt;<a href="mailto:fumanchu@aminus.org" target="_blank">fumanchu@aminus.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

&gt; On Sun, 2010-09-19 at 21:52 -0400, Chris McDonough wrote:<br>
&gt;<br>
&gt; &gt; I&#39;m -0 on the server trying to guess the Content-Length header.  It<br>
&gt; just<br>
&gt; &gt; doesn&#39;t seem like much of a burden to place on an application and<br>
&gt; it&#39;s<br>
&gt; &gt; easier to specify that an application must do this than it is to<br>
&gt; specify<br>
&gt; &gt; how a server should behave in the face of a missing Content-Length.<br>
&gt; I<br>
&gt; &gt; also believe Graham has argued against making the server guess, I<br>
&gt; &gt; presume this causes him some pain somehow (probably<br>
&gt; underspecification<br>
&gt; &gt; in WSGI).<br>
&gt;<br>
&gt; Graham&#39;s issues with requiring the server to set Content-Length are<br>
&gt; detailed here:<br>
&gt;<br>
&gt; <a href="http://blog.dscpl.com.au/2009/10/wsgi-issues-with-http-head-" target="_blank">http://blog.dscpl.com.au/2009/10/wsgi-issues-with-http-head-</a><br>
&gt; requests.html<br>
<br>
Chris,<br>
<br>
Thanks for that link. I had completely forgotten about that issue. I&#39;d<br>
really appreciate it if your web3 spec made some definitive decision on<br>
whether applications and middleware are responsible for correctly<br>
differentiating HEAD from GET, or whether servers should transform HEAD<br>
to GET before invoking the first application callable. I&#39;d personally<br>
prefer the former.</blockquote><div><br></div><div><br></div><div>Servers should definitely not transform a HEAD to a GET.</div><div><br></div><div>Transforming HEAD to GET and then discarding the body is often not a bad default but an application may well want to handle the HEAD explicitly. For instance, an application&#39;s HEAD handler may only need to check an ETag in a database before returning a &quot;304 Not Modified&quot; response (with the correct Content-Length and no body, of course).</div>

<div><br></div><div>Similarly, it&#39;s almost certainly a bad idea for a WSGI server or middleware to change the Content-Length header in the application&#39;s HTTP response because there may be no body to look at.</div>
<div><br></div><div>- Matt</div></div>