qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qexo-general] bug in response-status() / error-response()


From: Per Bothner
Subject: Re: [Qexo-general] bug in response-status() / error-response()
Date: Thu, 24 Jul 2003 13:22:26 -0700
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/20030612

Terje Pedersen wrote:

Example:
response-status(401)                                  (: Doesn't work :)
response-status(401,"")                              (: Working :)
response-status(401,"Some message")  (: Working :)

In HTTP.scm:

(define (response-status (code :: <int>) #!optional (message :: <String> #!null))
  (response-header '|Status|
                     (format (if (eq? message #!null) "~d" "~d ~a")
                             code message)))

I just added a space after ~d in the format line:
                     (format (if (eq? message #!null) "~d " "~d ~a")

Now it works.

Interesting. I just checked the HTTP spec, and it does require a space followed by a "Reason-Phrase" - though the latter can be empty.

It might be reasonable to default the message from the code. But rather than add a new table, I'm tempted to just make the message non-optional. After all:
  response-status(401, "Unauthorized")
is more reasable and self-documenting than:
  response-status(401)
though:
  response-status(http:unauthorized)
might be better than either!
--
        --Per Bothner
address@hidden   http://per.bothner.com/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]