httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Trawick" <traw...@gmail.com>
Subject Re: Empty Reason Phrase (BZ 44995/45092)
Date Tue, 20 May 2008 18:52:51 GMT
On Tue, May 20, 2008 at 8:56 AM, Rainer Jung <rainer.jung@kippdata.de> wrote:
> It seems that httpd 2.0 and 2.2 require a non empty reason phrase in the
> status line. RFC 2616 allows an empty reason phrase:
>
>  6.1 Status-Line
>
>  Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF
>
>  6.1.1 Status Code and Reason Phrase
>
>  Reason-Phrase  = *<TEXT, excluding CR, LF>
>
> Because of the star (*) I read this as "empty reason phrase is allowed".

right, there can be 0 repetitions

my bad ;)

> Do you agree, that empty reason phrases should be allowed?

yes

> If so, the below code fragments should be reviewed. I could provide the
> (trivial) patch.

replace "<=" with "<"

> Furthermore there is a second, related problem (for 2.x *and* 1.3): error
> pages use the status line as a title. If the line has an empty reason phrase
> *and* uses a custom http status code, error pages will show the title for
> status code 500.

looks like this code:

Index: modules/http/http_protocol.c
===================================================================
--- modules/http/http_protocol.c        (revision 658385)
+++ modules/http/http_protocol.c        (working copy)
@@ -1235,12 +1235,12 @@
          * with the 3 digit status code
          */
         if (r->status_line != NULL
-            && strlen(r->status_line) > 4       /* long enough */
+            && strlen(r->status_line) >= 4       /* long enough */
             && apr_isdigit(r->status_line[0])
             && apr_isdigit(r->status_line[1])
             && apr_isdigit(r->status_line[2])
             && apr_isspace(r->status_line[3])
-            && apr_isalnum(r->status_line[4])) {
+            && (r->status_line[4] == '\0' || apr_isalnum(r->status_line[4])))
{
             title = r->status_line;
         }

(nothing tested)

Mime
View raw message