]> granicus.if.org Git - apache/commitdiff
Testing len > 0 is redundant when *field is a "\0" and mismatches here.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 3 Aug 2016 21:18:12 +0000 (21:18 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Wed, 3 Aug 2016 21:18:12 +0000 (21:18 +0000)
folded flag was a no-op, unused once we added continue; logic.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1755114 13f79535-47bb-0310-9956-ffa450edef68

server/protocol.c

index 957b8be618b8cfdabb074117701964cdc103bc23..443416f8ae30c2810efa47598b3fa22dc79b4b00 100644 (file)
@@ -790,7 +790,6 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
      */
     while(1) {
         apr_status_t rv;
-        int folded = 0;
 
         field = NULL;
         rv = ap_rgetline(&field, r->server->limit_req_fieldsize + 2,
@@ -835,7 +834,8 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
             return;
         }
 
-        if ((len > 0) && ((*field == '\t') || *field == ' ')) {
+        /* Process an obs-fold immediately by appending it to last_field */
+        if ((*field == '\t') || *field == ' ') {
 
             if (last_field == NULL) {
                 r->status = HTTP_BAD_REQUEST;
@@ -891,7 +891,6 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
                 last_field[last_len] = ' ';
             }
             last_len += len;
-            folded = 1;
             continue;
         }
 
@@ -1024,10 +1023,8 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
          * the next loop iteration.  (In the folded case, last_field
          * has been updated already.)
          */
-        if (!folded) {
-            last_field = field;
-            last_len = len;
-        }
+        last_field = field;
+        last_len = len;
     }
 
     /* Combine multiple message-header fields with the same