You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2010/09/22 02:07:53 UTC
svn commit: r999694 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Author: trawick
Date: Wed Sep 22 00:07:52 2010
New Revision: 999694
URL: http://svn.apache.org/viewvc?rev=999694&view=rev
Log:
axe an unnecessary call to sscanf() when parsing the response line
from the origin server
apr_date_checkmask() already verified the expected text and digit
positions; all that is needed is to cheaply find which digits
Modified:
httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=999694&r1=999693&r2=999694&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Wed Sep 22 00:07:52 2010
@@ -1534,14 +1534,13 @@ apr_status_t ap_proxy_http_process_respo
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));