From 231daf1f0498eb2ebeac9cd2f4ccf49579a6b483 Mon Sep 17 00:00:00 2001 From: Greg Ames Date: Wed, 11 Dec 2002 22:30:37 +0000 Subject: [PATCH] ap_get_mime_headers: combine some error paths to remove a conditional 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 | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/server/protocol.c b/server/protocol.c index a0f2ad18af..a678af168c 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -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.
\n" - "
\n",
-                                       ap_escape_html(r->pool, field),
-                                       "
\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.
\n" + "
\n",
+                                           ap_escape_html(r->pool, field),
+                                           "
\n", NULL)); + } return; } -- 2.40.0