From: Christophe Jaillet Date: Fri, 1 Dec 2017 22:06:33 +0000 (+0000) Subject: Some small optimization: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6a14bb3e880d166560990fbc0f4072d34803ecd;p=apache Some small optimization: - use 'ap_cstr_casecmpn' instead of 'strncasecmp' - use 'apr_table_setn' when parameters are constant - avoid some memory allocation if the module can not handle a request git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1816919 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/mod_proxy_uwsgi.c b/modules/proxy/mod_proxy_uwsgi.c index 68a36c6ae5..e94905f8f2 100644 --- a/modules/proxy/mod_proxy_uwsgi.c +++ b/modules/proxy/mod_proxy_uwsgi.c @@ -63,7 +63,7 @@ static int uwsgi_canon(request_rec *r, char *url) const char *err, *path; apr_port_t port = UWSGI_DEFAULT_PORT; - if (strncasecmp(url, UWSGI_SCHEME "://", sizeof(UWSGI_SCHEME) + 2)) { + if (ap_cstr_casecmpn(url, UWSGI_SCHEME "://", sizeof(UWSGI_SCHEME) + 2)) { return DECLINED; } url += sizeof(UWSGI_SCHEME); /* Keep slashes */ @@ -166,7 +166,7 @@ static int uwsgi_send_headers(request_rec *r, proxy_conn_rec * conn) } else { if (!strcmp(script_name, "/")) { - apr_table_set(r->subprocess_env, "SCRIPT_NAME", ""); + apr_table_setn(r->subprocess_env, "SCRIPT_NAME", ""); } } } @@ -453,13 +453,15 @@ static int uwsgi_handler(request_rec *r, proxy_worker * worker, size_t w_len; char server_portstr[32]; char *u_path_info; - apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri)); + apr_uri_t *uri; - if (strncasecmp(url, UWSGI_SCHEME "://", sizeof(UWSGI_SCHEME) + 2)) { + if (ap_cstr_casecmpn(url, UWSGI_SCHEME "://", sizeof(UWSGI_SCHEME) + 2)) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "declining URL %s", url); return DECLINED; } + uri = apr_palloc(r->pool, sizeof(*uri)); + /* ADD PATH_INFO */ #if AP_MODULE_MAGIC_AT_LEAST(20111130,0) w_len = strlen(worker->s->name);