]> granicus.if.org Git - apache/commitdiff
ap_get_mime_headers: combine some error paths to remove a conditional
authorGreg Ames <gregames@apache.org>
Wed, 11 Dec 2002 22:30:37 +0000 (22:30 +0000)
committerGreg Ames <gregames@apache.org>
Wed, 11 Dec 2002 22:30:37 +0000 (22:30 +0000)
branch from the mainline path.

It might be worthwhile to move all the getline error handling into a
separate function and be a little more i-cache friendly.

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

server/protocol.c

index a0f2ad18afb779bc41a02f0e0d04328a99e8612b..a678af168c2b07ebaf80b9a663729c6f0833fe9b 100644 (file)
@@ -769,26 +769,24 @@ AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb
         rv = ap_rgetline(&field, r->server->limit_req_fieldsize + 2,
                          &len, r, 0, bb);
 
-        /* ap_rgetline returns APR_ENOSPC if it fills up the buffer before
-         * finding the end-of-line.  This is only going to happen if it
-         * exceeds the configured limit for a field size.
-         */
-        if (rv == APR_ENOSPC && field) {
-            r->status = HTTP_BAD_REQUEST;
-            /* insure ap_escape_html will terminate correctly */
-            field[len - 1] = '\0';
-            apr_table_setn(r->notes, "error-notes",
-                           apr_pstrcat(r->pool,
-                                       "Size of a request header field "
-                                       "exceeds server limit.<br />\n"
-                                       "<pre>\n",
-                                       ap_escape_html(r->pool, field),
-                                       "</pre>\n", NULL));
-            return;
-        }
-
         if (rv != APR_SUCCESS) {
             r->status = HTTP_BAD_REQUEST;
+
+            /* ap_rgetline returns APR_ENOSPC if it fills up the buffer before
+             * finding the end-of-line.  This is only going to happen if it
+             * exceeds the configured limit for a field size.
+             */
+            if (rv == APR_ENOSPC && field) {
+                /* insure ap_escape_html will terminate correctly */
+                field[len - 1] = '\0';
+                apr_table_setn(r->notes, "error-notes",
+                               apr_pstrcat(r->pool,
+                                           "Size of a request header field "
+                                           "exceeds server limit.<br />\n"
+                                           "<pre>\n",
+                                           ap_escape_html(r->pool, field),
+                                           "</pre>\n", NULL));
+            }
             return;
         }