You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2017/12/01 22:06:33 UTC
svn commit: r1816919 - /httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c
Author: jailletc36
Date: Fri Dec 1 22:06:33 2017
New Revision: 1816919
URL: http://svn.apache.org/viewvc?rev=1816919&view=rev
Log:
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
Modified:
httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c
Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c?rev=1816919&r1=1816918&r2=1816919&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_uwsgi.c Fri Dec 1 22:06:33 2017
@@ -63,7 +63,7 @@ static int uwsgi_canon(request_rec *r, c
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_re
}
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,
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);