Preserve negative HTTP status numbers
authorFabian Keil <fk@fabiankeil.de>
Mon, 3 Nov 2014 14:41:12 +0000 (14:41 +0000)
committerFabian Keil <fk@fabiankeil.de>
Mon, 3 Nov 2014 14:41:12 +0000 (14:41 +0000)
While they are technically invalid, "supporting" them doesn't
hurt and this gets the recently added curl test 1430 "working".

parsers.c

index 4111996..9b402ba 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -1,4 +1,4 @@
-const char parsers_rcs[] = "$Id: parsers.c,v 1.294 2014/10/18 11:30:04 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.295 2014/10/18 11:30:56 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/parsers.c,v $
@@ -3878,7 +3878,7 @@ static jb_err server_http(struct client_state *csp, char **header)
       reason_phrase="";
    }
 
       reason_phrase="";
    }
 
-   if (3 != sscanf(*header, "HTTP/%u.%u %u", &major_version,
+   if (3 != sscanf(*header, "HTTP/%u.%u %d", &major_version,
          &minor_version, &(csp->http->status)))
    {
       log_error(LOG_LEVEL_ERROR,
          &minor_version, &(csp->http->status)))
    {
       log_error(LOG_LEVEL_ERROR,
@@ -3913,7 +3913,7 @@ static jb_err server_http(struct client_state *csp, char **header)
    length = sizeof("HTTP/1.1 200 ") + strlen(reason_phrase) + 1;
    new_response_line = malloc_or_die(length);
 
    length = sizeof("HTTP/1.1 200 ") + strlen(reason_phrase) + 1;
    new_response_line = malloc_or_die(length);
 
-   snprintf(new_response_line, length, "HTTP/%u.%u %u %s",
+   snprintf(new_response_line, length, "HTTP/%u.%u %d %s",
       major_version, minor_version, csp->http->status, reason_phrase);
 
    if (0 != strcmp(*header, new_response_line))
       major_version, minor_version, csp->http->status, reason_phrase);
 
    if (0 != strcmp(*header, new_response_line))