httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject cvs commit: apache-1.3/src/main http_protocol.c
Date Tue, 08 Jan 2002 16:26:18 GMT
martin      02/01/08 08:26:18

  Modified:    src/main http_protocol.c
  Log:
  Sorry -- undoing accidentally committed stuff. The Content-Length
  fix of the preceding commit is preserved.
  
  Revision  Changes    Path
  1.305     +6 -33     apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.304
  retrieving revision 1.305
  diff -u -r1.304 -r1.305
  --- http_protocol.c	8 Jan 2002 15:09:48 -0000	1.304
  +++ http_protocol.c	8 Jan 2002 16:26:18 -0000	1.305
  @@ -1041,43 +1041,16 @@
           r->protocol  = ap_pstrdup(r->pool, "HTTP/1.0");
           return 0;
       }
  +
       r->assbackwards = (ll[0] == '\0');
       r->protocol = ap_pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9");
   
  -    /* The following test tries to skip past the "HTTP/nn.mm"
  -     * protocol string, collecting major=nn and minor=mm.
  -     * ll is advanced past "HTTP/nn.mm" so that it can be checked
  -     * for proper string termination (only valid chars: \r\n).
  -     */
  -    if (memcmp(ll,"HTTP/",5) == 0 && isdigit(ll[5])) {
  -
  -        /* Read major protocol level: */
  -        major = strtol(&ll[5], &ll, 10);
  -        if (errno != ERANGE && ll[0] == '/' && isdigit(ll[1])) {
  -
  -            /* Read minor protocol level: */
  -            minor = strtol(&ll[1], &ll, 10);
  +    if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor)
  +      && minor < HTTP_VERSION(1,0))	/* don't allow HTTP/0.1000 */
  +	r->proto_num = HTTP_VERSION(major, minor);
  +    else
  +	r->proto_num = HTTP_VERSION(1,0);
   
  -	    if (errno != ERANGE) { 
  -                if (minor < HTTP_VERSION(1,0))	/* don't allow HTTP/0.1000 */
  -                    r->proto_num = HTTP_VERSION(major, minor);
  -                else
  -                    r->proto_num = HTTP_VERSION(1,0);
  -	    }
  -	}
  -    }
  -    /* If the request does not end after the "HTTP/x.y\r\n" (or after the
  -     * URI in HTTP/0.9), then signal an error condition [400 Bad Request].
  -     */
  -    if (ll[strspn(ll," \r\n")] != '\0') {
  -        ap_table_setn(r->notes, "error-notes",
  -                      "Request line not ending properly after \"HTTP/x.y\":"
  -                      "<PRE>\n", ap_escape_html(r->pool, r->protocol), "</PRE>");
  -        r->status    = HTTP_BAD_REQUEST;
  -        r->proto_num = HTTP_VERSION(1,0);
  -        r->protocol  = ap_pstrdup(r->pool, "HTTP/1.0");
  -        return 0;
  -    }
       return 1;
   }
   
  
  
  

Mime
View raw message