From: Guenter Knauf Date: Wed, 6 Oct 2010 10:48:13 +0000 (+0000) Subject: Go a little faster by eliminating a sscanf() call when parsing response lines. X-Git-Tag: 2.2.17~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58be5dd6aec032a4ecf49758a9e308ec11a6da7d;p=thirdparty%2Fapache%2Fhttpd.git Go a little faster by eliminating a sscanf() call when parsing response lines. Backport r999694; AUthor: trawick, reviewed by: sf, wrowe. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1004983 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 5ba53781368..36adefda2cd 100644 --- a/STATUS +++ b/STATUS @@ -129,12 +129,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.2.x patch: http://people.apache.org/~trawick/fewerwarnings-2.txt +1: trawick, sf, wrowe - * mod_proxy_http: Go a little faster by eliminating a sscanf() call - when parsing response lines. - Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=999694 - 2.2.x patch: trunk patch works - +1: trawick, sf, wrowe - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 83d4e23a415..e0a8ae11168 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1473,14 +1473,13 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r, if (apr_date_checkmask(buffer, "HTTP/#.# ###*")) { int major, minor; - if (2 != sscanf(buffer, "HTTP/%u.%u", &major, &minor)) { - major = 1; - minor = 1; - } + major = buffer[5] - '0'; + minor = buffer[7] - '0'; + /* If not an HTTP/1 message or * if the status line was > 8192 bytes */ - else if ((buffer[5] != '1') || (len >= sizeof(buffer)-1)) { + if ((major != 1) || (len >= sizeof(buffer)-1)) { return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(p, "Corrupt status line returned by remote " "server: ", buffer, NULL));