[racket-dev] Documentation lacuna?

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Mon Jan 21 07:23:31 EST 2013


In the web server, the documentation for RESPONSE and, by implication, RESPONSE/FULL does not explain how to avoid including a message-body in the response, as is required for 1xx, 204, 304 statuses (and those alone).

By experiment, giving RESPONSE/FULL a 'body' argument of #"" produces the right effect, but:

  (a) it would be reassuring if this case was mentioned in the documentation;

  (b) this still produces a content-length:0 header.

A problem is that without reassurance in (a), giving an empty 'body' feels slightly like a hack.  It might be that allowing an 'output' or 'body'' argument of #f would communicate the intent more clearly.

Regarding (b), RFC 2616 Sect. 4.4 doesn't say that a Content-Length header is invalid in one of these responses, but it does imply (point 1 in that section) that the Content-Length header should be ignored in that case.  This means that it's slightly unsightly (no more) that the header appears in a RESPONSE/FULL response.

So, suggestion: either support an 'output' (for RESPONSE) or 'body' (for RESPONSE/FULL) argument of #f, which is documented to be appropriate only for certain statuses, and which suppresses the content-length; or document that giving a 'body' of #"" is indeed the approved way of giving a no-body response for these statuses, and that the content-length is generated but redundant.

Best wishes,


Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK

Posted on the dev mailing list.