You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2016/08/03 21:18:12 UTC

svn commit: r1755114 - /httpd/httpd/trunk/server/protocol.c

Author: wrowe
Date: Wed Aug  3 21:18:12 2016
New Revision: 1755114

URL: http://svn.apache.org/viewvc?rev=1755114&view=rev
Log:
Testing len > 0 is redundant when *field is a "\0" and mismatches here.

folded flag was a no-op, unused once we added continue; logic.


Modified:
    httpd/httpd/trunk/server/protocol.c

Modified: httpd/httpd/trunk/server/protocol.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/protocol.c?rev=1755114&r1=1755113&r2=1755114&view=diff
==============================================================================
--- httpd/httpd/trunk/server/protocol.c (original)
+++ httpd/httpd/trunk/server/protocol.c Wed Aug  3 21:18:12 2016
@@ -790,7 +790,6 @@ AP_DECLARE(void) ap_get_mime_headers_cor
      */
     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_cor
             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_cor
                 last_field[last_len] = ' ';
             }
             last_len += len;
-            folded = 1;
             continue;
         }
 
@@ -1024,10 +1023,8 @@ AP_DECLARE(void) ap_get_mime_headers_cor
          * 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