[racket-dev] Documentation lacuna?

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Jan 21 11:12:50 EST 2013

I don't understand your concern.

The response structure, which is the only actual structure (everything
else is an interface on it)...

a) Allows #f as the mime type
b) Has you provide an 'output' function that does the output. If you
don't want there to be any output, then don't write any:

(response 304 #"304" (current-seconds) #f empty void)

So, what exactly is it that you want, if not what is already provided?
You just want the documentation to say that functions don't have to
use their arguments, lists can be empty, and various strings can be
empty too? Can you give a suggested change, since I don't really
understand the problem?

Jay



On Mon, Jan 21, 2013 at 5:34 AM, Norman Gray <norman at astro.gla.ac.uk> wrote:
>
> Sorry, an addendum...
>
> On 2013 Jan 21, at 12:23, Norman Gray <norman at astro.gla.ac.uk> wrote:
>
>> 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.
>
> The other thing (ahem...) is that without such an explanation, it's not clear what to put as the MIME type.
>
> Since there's no content, it's tempting to conclude that the 'mime' argument is ignored.  If, however, one gives this argument as #"" (on the grounds that it doesn't matter what it is), this is faithfully send down the wire as a "Content-Type: " header, which is invalid.  Giving 'mime' as #f (which is allowed in the contract of RESPONSE but not otherwise documented) _does_ suppress the content-type header, even though the documentation for RESPONSE states that the server will automatically add a Content-Type header if one is not present.
>
> That is, one can produce the correct behaviour here, even though the documentation seems to suggest that no-body responses will be problematic.
>
> Best wishes,
>
> Norman
>
>
> --
> Norman Gray  :  http://nxg.me.uk
> SUPA School of Physics and Astronomy, University of Glasgow, UK
>
>
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93


Posted on the dev mailing list.