dgaudet     98/05/25 15:55:40

  Modified:    src/main http_protocol.c
  Log:
  - style correction
  - eliminate an unneeded extra MAX_STRING_LEN buffer
  - add some XXX comments
  
  Revision  Changes    Path
  1.215     +25 -19    apache-1.3/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_protocol.c,v
  retrieving revision 1.214
  retrieving revision 1.215
  diff -u -r1.214 -r1.215
  --- http_protocol.c   1998/05/21 04:11:27     1.214
  +++ http_protocol.c   1998/05/25 22:55:39     1.215
  @@ -662,8 +662,9 @@
                       "request failed for %s, reason: URI too long",
               ap_get_remote_host(r->connection, r->per_dir_config, 
REMOTE_NAME));
        /* hack to deal with the HTTP_REQUEST_TIME_OUT setting up above: */
  -     if (r->status == HTTP_REQUEST_TIME_OUT)
  -       r->status = HTTP_OK;
  +     if (r->status == HTTP_REQUEST_TIME_OUT) {
  +         r->status = HTTP_OK;
  +     }
        r->request_time = time(NULL);
        ap_die (HTTP_REQUEST_URI_TOO_LARGE, r);
           return 0;
  @@ -718,38 +719,42 @@
   
       /*
        * Read header lines until we get the empty separator line, a read error,
  -     * the connection closes (EOF), or we timeout. Should we also check for
  -     * overflow (len == MAX_STRING_LEN-1)?
  +     * the connection closes (EOF), or we timeout.
        */
       while ((len = getline(field, MAX_STRING_LEN, c->client, 1)) > 0) {
           char *copy = ap_palloc(r->pool, len + 1);
           memcpy(copy, field, len + 1);
        
        if (!(value = strchr(copy, ':'))) {     /* Find the colon separator */
  -       /* if there's none, this request is screwed up.
  -        * a hack to deal with how we set HTTP_REQUEST_TIME_OUT earlier.*/
  -       if (r->status == HTTP_REQUEST_TIME_OUT)
  -         r->status = HTTP_OK;
  -       
  -       ap_die (HTTP_BAD_REQUEST, r);
  -       return;
  +         /* if there's none, this request is screwed up.
  +          * a hack to deal with how we set HTTP_REQUEST_TIME_OUT earlier.*/
  +         if (r->status == HTTP_REQUEST_TIME_OUT)
  +             r->status = HTTP_OK;
  +         
  +         ap_die (HTTP_BAD_REQUEST, r);
  +         return;
        }
   
           *value = '\0';
           ++value;
  +     /* XXX: RFC2068 defines only SP and HT as whitespace, this test is
  +      * wrong... and so are many others probably.
  +      */
           while (isspace(*value))
               ++value;            /* Skip to start of value   */
   
  +     /* XXX: should strip trailing whitespace as well */
  +
           ap_table_mergen(r->headers_in, copy, value);
   
        /* the header was too long; at the least we should skip extra data */
        if (len >= MAX_STRING_LEN - 1) { 
  -       char junk[MAX_STRING_LEN];     
  -       while ((len = getline(junk, MAX_STRING_LEN, c->client, 1))
  -              >= MAX_STRING_LEN - 1)   /* soak up the extra data */
  -         ;
  -       if (len == 0) /* time to exit the larger loop as well */
  -         break;
  +         while ((len = getline(field, MAX_STRING_LEN, c->client, 1))
  +                 >= MAX_STRING_LEN - 1) {
  +             /* soak up the extra data */
  +         }
  +         if (len == 0) /* time to exit the larger loop as well */
  +             break;
        }
       }
   }
  @@ -798,8 +803,10 @@
       ap_keepalive_timeout("read request line", r);
       if (!read_request_line(r)) {
           ap_kill_timeout(r);
  -     if (r->status != HTTP_REQUEST_TIME_OUT)  /* we must have had an error.*/
  +     if (r->status != HTTP_REQUEST_TIME_OUT) {
  +         /* we must have had an error.*/
            ap_log_transaction(r);
  +     }
           return NULL;
       }
       if (!r->assbackwards) {
  @@ -832,7 +839,6 @@
       if ((access_status = ap_run_post_read_request(r))) {
           ap_die(access_status, r);
        ap_log_transaction(r);
  -
           return NULL;
       }
   
  
  
  

Reply via email to