]> granicus.if.org Git - apache/commitdiff
Use new ap_casecmpstr[n]() functions where appropriate (not exhaustive).
authorYann Ylavic <ylavic@apache.org>
Mon, 23 Nov 2015 12:33:09 +0000 (12:33 +0000)
committerYann Ylavic <ylavic@apache.org>
Mon, 23 Nov 2015 12:33:09 +0000 (12:33 +0000)
[Reverted by r1715869]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715789 13f79535-47bb-0310-9956-ffa450edef68

33 files changed:
modules/cache/cache_util.c
modules/filters/mod_deflate.c
modules/filters/mod_include.c
modules/filters/mod_proxy_html.c
modules/generators/mod_autoindex.c
modules/generators/mod_cgi.c
modules/generators/mod_cgid.c
modules/http/byterange_filter.c
modules/http/http_filters.c
modules/http2/h2_from_h1.c
modules/loggers/mod_log_config.c
modules/mappers/mod_rewrite.c
modules/metadata/mod_cern_meta.c
modules/metadata/mod_headers.c
modules/proxy/ajp_header.c
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy_ajp.c
modules/proxy/mod_proxy_balancer.c
modules/proxy/mod_proxy_fcgi.c
modules/proxy/mod_proxy_fdpass.c
modules/proxy/mod_proxy_ftp.c
modules/proxy/mod_proxy_http.c
modules/proxy/mod_proxy_scgi.c
modules/proxy/mod_proxy_wstunnel.c
modules/proxy/mod_serf.c
modules/proxy/proxy_util.c
modules/slotmem/mod_slotmem_shm.c
modules/test/mod_policy.c
server/mpm_unix.c
server/protocol.c
server/util.c
server/util_expr_eval.c
server/util_script.c

index b29d2eee4a6fac9b6ad88f2cab11d51b1d7d15e9..343ca003ea629cecca4a4a36c406b3b77aef3bcc 100644 (file)
@@ -594,7 +594,12 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
     }
 
     if ((agestr = apr_table_get(h->resp_hdrs, "Age"))) {
-        age_c = apr_atoi64(agestr);
+        char *endp;
+        apr_off_t offt;
+        if (!apr_strtoff(&offt, agestr, &endp, 10)
+                && endp > agestr && !*endp) {
+            age_c = offt;
+        }
     }
 
     /* calculate age of object */
@@ -994,12 +999,7 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
         char *header = apr_pstrdup(r->pool, pragma_header);
         const char *token = cache_strqtok(header, CACHE_SEPARATOR, &last);
         while (token) {
-            /* handle most common quickest case... */
-            if (!strcmp(token, "no-cache")) {
-                cc->no_cache = 1;
-            }
-            /* ...then try slowest case */
-            else if (!strcasecmp(token, "no-cache")) {
+            if (!ap_casecmpstr(token, "no-cache")) {
                 cc->no_cache = 1;
             }
             token = cache_strqtok(NULL, CACHE_SEPARATOR, &last);
@@ -1008,21 +1008,15 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
     }
 
     if (cc_header) {
+        char *endp;
+        apr_off_t offt;
         char *header = apr_pstrdup(r->pool, cc_header);
         const char *token = cache_strqtok(header, CACHE_SEPARATOR, &last);
         while (token) {
             switch (token[0]) {
             case 'n':
             case 'N': {
-                /* handle most common quickest cases... */
-                if (!strcmp(token, "no-cache")) {
-                    cc->no_cache = 1;
-                }
-                else if (!strcmp(token, "no-store")) {
-                    cc->no_store = 1;
-                }
-                /* ...then try slowest cases */
-                else if (!strncasecmp(token, "no-cache", 8)) {
+                if (!ap_casecmpstrn(token, "no-cache", 8)) {
                     if (token[8] == '=') {
                         cc->no_cache_header = 1;
                     }
@@ -1031,73 +1025,63 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
                     }
                     break;
                 }
-                else if (!strcasecmp(token, "no-store")) {
+                else if (!ap_casecmpstr(token, "no-store")) {
                     cc->no_store = 1;
                 }
-                else if (!strcasecmp(token, "no-transform")) {
+                else if (!ap_casecmpstr(token, "no-transform")) {
                     cc->no_transform = 1;
                 }
                 break;
             }
             case 'm':
             case 'M': {
-                /* handle most common quickest cases... */
-                if (!strcmp(token, "max-age=0")) {
-                    cc->max_age = 1;
-                    cc->max_age_value = 0;
-                }
-                else if (!strcmp(token, "must-revalidate")) {
-                    cc->must_revalidate = 1;
-                }
-                /* ...then try slowest cases */
-                else if (!strncasecmp(token, "max-age", 7)) {
-                    if (token[7] == '=') {
+                if (!ap_casecmpstrn(token, "max-age", 7)) {
+                    if (token[7] == '='
+                            && !apr_strtoff(&offt, token + 8, &endp, 10)
+                            && endp > token + 8 && !*endp) {
                         cc->max_age = 1;
-                        cc->max_age_value = apr_atoi64(token + 8);
+                        cc->max_age_value = offt;
                     }
-                    break;
                 }
-                else if (!strncasecmp(token, "max-stale", 9)) {
-                    if (token[9] == '=') {
+                else if (!ap_casecmpstr(token, "must-revalidate")) {
+                    cc->must_revalidate = 1;
+                }
+                else if (!ap_casecmpstrn(token, "max-stale", 9)) {
+                    if (token[9] == '='
+                             && !apr_strtoff(&offt, token + 10, &endp, 10)
+                             && endp > token + 10 && !*endp) {
                         cc->max_stale = 1;
-                        cc->max_stale_value = apr_atoi64(token + 10);
+                        cc->max_stale_value = offt;
                     }
-                    else if (!token[10]) {
+                    else if (!token[9]) {
                         cc->max_stale = 1;
                         cc->max_stale_value = -1;
                     }
                     break;
                 }
-                else if (!strncasecmp(token, "min-fresh", 9)) {
-                    if (token[9] == '=') {
+                else if (!ap_casecmpstrn(token, "min-fresh", 9)) {
+                    if (token[9] == '='
+                            && !apr_strtoff(&offt, token + 10, &endp, 10)
+                            && endp > token + 10 && !*endp) {
                         cc->min_fresh = 1;
-                        cc->min_fresh_value = apr_atoi64(token + 10);
+                        cc->min_fresh_value = offt;
                     }
                     break;
                 }
-                else if (!strcasecmp(token, "must-revalidate")) {
-                    cc->must_revalidate = 1;
-                }
                 break;
             }
             case 'o':
             case 'O': {
-                if (!strcasecmp(token, "only-if-cached")) {
+                if (!ap_casecmpstr(token, "only-if-cached")) {
                     cc->only_if_cached = 1;
                 }
                 break;
             }
-            case 'p':
-            case 'P': {
-                /* handle most common quickest cases... */
-                if (!strcmp(token, "private")) {
-                    cc->private = 1;
-                }
-                /* ...then try slowest cases */
-                else if (!strcasecmp(token, "public")) {
+            case 'p': {
+                if (!ap_casecmpstr(token, "public")) {
                     cc->public = 1;
                 }
-                else if (!strncasecmp(token, "private", 7)) {
+                else if (!ap_casecmpstrn(token, "private", 7)) {
                     if (token[7] == '=') {
                         cc->private_header = 1;
                     }
@@ -1106,19 +1090,20 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
                     }
                     break;
                 }
-                else if (!strcasecmp(token, "proxy-revalidate")) {
+                else if (!ap_casecmpstr(token, "proxy-revalidate")) {
                     cc->proxy_revalidate = 1;
                 }
                 break;
             }
             case 's':
             case 'S': {
-                if (!strncasecmp(token, "s-maxage", 8)) {
-                    if (token[8] == '=') {
+                if (!ap_casecmpstrn(token, "s-maxage", 8)) {
+                    if (token[8] == '='
+                            && !apr_strtoff(&offt, token + 9, &endp, 10)
+                            && endp > token + 9 && !*endp) {
                         cc->s_maxage = 1;
-                        cc->s_maxage_value = apr_atoi64(token + 9);
+                        cc->s_maxage_value = offt;
                     }
-                    break;
                 }
                 break;
             }
@@ -1148,8 +1133,7 @@ static int cache_control_remove(request_rec *r, const char *cc_header,
             switch (token[0]) {
             case 'n':
             case 'N': {
-                if (!strncmp(token, "no-cache", 8)
-                        || !strncasecmp(token, "no-cache", 8)) {
+                if (!ap_casecmpstrn(token, "no-cache", 8)) {
                     if (token[8] == '=') {
                         const char *header = cache_strqtok(token + 9,
                                 CACHE_SEPARATOR "\"", &slast);
@@ -1166,8 +1150,7 @@ static int cache_control_remove(request_rec *r, const char *cc_header,
             }
             case 'p':
             case 'P': {
-                if (!strncmp(token, "private", 7)
-                        || !strncasecmp(token, "private", 7)) {
+                if (!ap_casecmpstrn(token, "private", 7)) {
                     if (token[7] == '=') {
                         const char *header = cache_strqtok(token + 8,
                                 CACHE_SEPARATOR "\"", &slast);
index c65d029383fae57b2ef2c0d2f76e34b997c9a2b4..a8d501220355e9b9fa0c6a62dc6858ed514f4e9a 100644 (file)
@@ -123,8 +123,8 @@ static int check_gzip(request_rec *r, apr_table_t *hdrs1, apr_table_t *hdrs2)
     if (encoding && *encoding) {
 
         /* check the usual/simple case first */
-        if (!strcasecmp(encoding, "gzip")
-            || !strcasecmp(encoding, "x-gzip")) {
+        if (!ap_casecmpstr(encoding, "gzip")
+            || !ap_casecmpstr(encoding, "x-gzip")) {
             found = 1;
             if (hdrs) {
                 apr_table_unset(hdrs, "Content-Encoding");
@@ -142,8 +142,8 @@ static int check_gzip(request_rec *r, apr_table_t *hdrs1, apr_table_t *hdrs2)
             for(;;) {
                 char *token = ap_strrchr(new_encoding, ',');
                 if (!token) {        /* gzip:identity or other:identity */
-                    if (!strcasecmp(new_encoding, "gzip")
-                        || !strcasecmp(new_encoding, "x-gzip")) {
+                    if (!ap_casecmpstr(new_encoding, "gzip")
+                        || !ap_casecmpstr(new_encoding, "x-gzip")) {
                         found = 1;
                         if (hdrs) {
                             apr_table_unset(hdrs, "Content-Encoding");
@@ -155,8 +155,8 @@ static int check_gzip(request_rec *r, apr_table_t *hdrs1, apr_table_t *hdrs2)
                     break; /* seen all tokens */
                 }
                 for (ptr=token+1; apr_isspace(*ptr); ++ptr);
-                if (!strcasecmp(ptr, "gzip")
-                    || !strcasecmp(ptr, "x-gzip")) {
+                if (!ap_casecmpstr(ptr, "gzip")
+                    || !ap_casecmpstr(ptr, "x-gzip")) {
                     *token = '\0';
                     if (hdrs) {
                         apr_table_setn(hdrs, "Content-Encoding", new_encoding);
@@ -166,7 +166,7 @@ static int check_gzip(request_rec *r, apr_table_t *hdrs1, apr_table_t *hdrs2)
                     }
                     found = 1;
                 }
-                else if (!ptr[0] || !strcasecmp(ptr, "identity")) {
+                else if (!ptr[0] || !ap_casecmpstr(ptr, "identity")) {
                     *token = '\0';
                     continue; /* strip the token and find the next one */
                 }
@@ -744,7 +744,7 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
             }
 
             token = ap_get_token(r->pool, &accepts, 0);
-            while (token && token[0] && strcasecmp(token, "gzip")) {
+            while (token && token[0] && ap_casecmpstr(token, "gzip")) {
                 /* skip parameters, XXX: ;q=foo evaluation? */
                 while (*accepts == ';') {
                     ++accepts;
@@ -818,7 +818,7 @@ static apr_status_t deflate_out_filter(ap_filter_t *f,
          */
 
         /* If the entire Content-Encoding is "identity", we can replace it. */
-        if (!encoding || !strcasecmp(encoding, "identity")) {
+        if (!encoding || !ap_casecmpstr(encoding, "identity")) {
             apr_table_setn(r->headers_out, "Content-Encoding", "gzip");
         }
         else {
index 95ab4d2b22606b962496b83ef4a132d94534a626..df5231c3b0ece014b64c4e0bdd156de1376efc0e 100644 (file)
@@ -620,16 +620,16 @@ static void add_include_vars(request_rec *r)
 static const char *add_include_vars_lazy(request_rec *r, const char *var, const char *timefmt)
 {
     char *val;
-    if (!strcasecmp(var, "DATE_LOCAL")) {
+    if (!ap_casecmpstr(var, "DATE_LOCAL")) {
         val = ap_ht_time(r->pool, r->request_time, timefmt, 0);
     }
-    else if (!strcasecmp(var, "DATE_GMT")) {
+    else if (!ap_casecmpstr(var, "DATE_GMT")) {
         val = ap_ht_time(r->pool, r->request_time, timefmt, 1);
     }
-    else if (!strcasecmp(var, "LAST_MODIFIED")) {
+    else if (!ap_casecmpstr(var, "LAST_MODIFIED")) {
         val = ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0);
     }
-    else if (!strcasecmp(var, "USER_NAME")) {
+    else if (!ap_casecmpstr(var, "USER_NAME")) {
         if (apr_uid_name_get(&val, r->finfo.user, r->pool) != APR_SUCCESS) {
             val = "<unknown>";
         }
@@ -714,9 +714,9 @@ static int include_expr_lookup(ap_expr_lookup_parms *parms)
 {
     switch (parms->type) {
     case AP_EXPR_FUNC_STRING:
-        if (strcasecmp(parms->name, "v") == 0 ||
-            strcasecmp(parms->name, "reqenv") == 0 ||
-            strcasecmp(parms->name, "env") == 0) {
+        if (ap_casecmpstr(parms->name, "v") == 0 ||
+            ap_casecmpstr(parms->name, "reqenv") == 0 ||
+            ap_casecmpstr(parms->name, "env") == 0) {
             *parms->func = include_expr_var_fn;
             *parms->data = parms->name;
             return OK;
@@ -1947,25 +1947,25 @@ static apr_status_t handle_echo(include_ctx_t *ctx, ap_filter_t *f,
                 token = apr_strtok(d, ", \t", &last);
 
                 while (token) {
-                    if (!strcasecmp(token, "none")) {
+                    if (!ap_casecmpstr(token, "none")) {
                         /* do nothing */
                     }
-                    else if (!strcasecmp(token, "url")) {
+                    else if (!ap_casecmpstr(token, "url")) {
                         char *buf = apr_pstrdup(ctx->pool, echo_text);
                         ap_unescape_url(buf);
                         echo_text = buf;
                     }
-                    else if (!strcasecmp(token, "urlencoded")) {
+                    else if (!ap_casecmpstr(token, "urlencoded")) {
                         char *buf = apr_pstrdup(ctx->pool, echo_text);
                         ap_unescape_urlencoded(buf);
                         echo_text = buf;
                     }
-                    else if (!strcasecmp(token, "entity")) {
+                    else if (!ap_casecmpstr(token, "entity")) {
                         char *buf = apr_pstrdup(ctx->pool, echo_text);
                         decodehtml(buf);
                         echo_text = buf;
                     }
-                    else if (!strcasecmp(token, "base64")) {
+                    else if (!ap_casecmpstr(token, "base64")) {
                         echo_text = ap_pbase64decode(ctx->dpool, echo_text);
                     }
                     else {
@@ -1983,19 +1983,19 @@ static apr_status_t handle_echo(include_ctx_t *ctx, ap_filter_t *f,
                 token = apr_strtok(e, ", \t", &last);
 
                 while (token) {
-                    if (!strcasecmp(token, "none")) {
+                    if (!ap_casecmpstr(token, "none")) {
                         /* do nothing */
                     }
-                    else if (!strcasecmp(token, "url")) {
+                    else if (!ap_casecmpstr(token, "url")) {
                         echo_text = ap_escape_uri(ctx->dpool, echo_text);
                     }
-                    else if (!strcasecmp(token, "urlencoded")) {
+                    else if (!ap_casecmpstr(token, "urlencoded")) {
                         echo_text = ap_escape_urlencoded(ctx->dpool, echo_text);
                     }
-                    else if (!strcasecmp(token, "entity")) {
+                    else if (!ap_casecmpstr(token, "entity")) {
                         echo_text = ap_escape_html2(ctx->dpool, echo_text, 0);
                     }
-                    else if (!strcasecmp(token, "base64")) {
+                    else if (!ap_casecmpstr(token, "base64")) {
                         char *buf;
                         buf = ap_pbase64encode(ctx->dpool, (char *)echo_text);
                         echo_text = buf;
@@ -2585,25 +2585,25 @@ static apr_status_t handle_set(include_ctx_t *ctx, ap_filter_t *f,
                 token = apr_strtok(d, ", \t", &last);
 
                 while (token) {
-                    if (!strcasecmp(token, "none")) {
+                    if (!ap_casecmpstr(token, "none")) {
                         /* do nothing */
                     }
-                    else if (!strcasecmp(token, "url")) {
+                    else if (!ap_casecmpstr(token, "url")) {
                         char *buf = apr_pstrdup(ctx->pool, parsed_string);
                         ap_unescape_url(buf);
                         parsed_string = buf;
                     }
-                    else if (!strcasecmp(token, "urlencoded")) {
+                    else if (!ap_casecmpstr(token, "urlencoded")) {
                         char *buf = apr_pstrdup(ctx->pool, parsed_string);
                         ap_unescape_urlencoded(buf);
                         parsed_string = buf;
                     }
-                    else if (!strcasecmp(token, "entity")) {
+                    else if (!ap_casecmpstr(token, "entity")) {
                         char *buf = apr_pstrdup(ctx->pool, parsed_string);
                         decodehtml(buf);
                         parsed_string = buf;
                     }
-                    else if (!strcasecmp(token, "base64")) {
+                    else if (!ap_casecmpstr(token, "base64")) {
                         parsed_string = ap_pbase64decode(ctx->dpool, parsed_string);
                     }
                     else {
@@ -2621,19 +2621,19 @@ static apr_status_t handle_set(include_ctx_t *ctx, ap_filter_t *f,
                 token = apr_strtok(e, ", \t", &last);
 
                 while (token) {
-                    if (!strcasecmp(token, "none")) {
+                    if (!ap_casecmpstr(token, "none")) {
                         /* do nothing */
                     }
-                    else if (!strcasecmp(token, "url")) {
+                    else if (!ap_casecmpstr(token, "url")) {
                         parsed_string = ap_escape_uri(ctx->dpool, parsed_string);
                     }
-                    else if (!strcasecmp(token, "urlencoded")) {
+                    else if (!ap_casecmpstr(token, "urlencoded")) {
                         parsed_string = ap_escape_urlencoded(ctx->dpool, parsed_string);
                     }
-                    else if (!strcasecmp(token, "entity")) {
+                    else if (!ap_casecmpstr(token, "entity")) {
                         parsed_string = ap_escape_html2(ctx->dpool, parsed_string, 0);
                     }
-                    else if (!strcasecmp(token, "base64")) {
+                    else if (!ap_casecmpstr(token, "base64")) {
                         char *buf;
                         buf = ap_pbase64encode(ctx->dpool, (char *)parsed_string);
                         parsed_string = buf;
index f760829287cb597b5c37b42108751fd8b83ebd3e..e949fe49aa73408c0aa112b4e7baf6f17fb1f43e 100644 (file)
@@ -295,8 +295,8 @@ static void pinternalSubset(void* ctxt, const xmlChar *name,
     }
     ap_fputstrs(ctx->f->next, ctx->bb, "<!DOCTYPE ", (const char *)name, NULL);
     if (externalID) {
-        if (!strcasecmp((const char*)name, "html") &&
-            !strncasecmp((const char *)externalID, "-//W3C//DTD XHTML ", 18)) {
+        if (!ap_casecmpstr((const char*)name, "html") &&
+            !ap_casecmpstrn((const char *)externalID, "-//W3C//DTD XHTML ", 18)) {
             ctx->etag = xhtml_etag;
         }
         else {
@@ -690,7 +690,7 @@ static meta *metafix(request_rec *r, const char *buf)
         while (!apr_isalpha(*++p));
         for (q = p; apr_isalnum(*q) || (*q == '-'); ++q);
         header = apr_pstrndup(r->pool, p, q-p);
-        if (strncasecmp(header, "Content-", 8)) {
+        if (ap_casecmpstrn(header, "Content-", 8)) {
             /* find content=... string */
             p = apr_strmatch(seek_content, buf+offs+pmatch[0].rm_so,
                               pmatch[0].rm_eo - pmatch[0].rm_so);
@@ -718,7 +718,7 @@ static meta *metafix(request_rec *r, const char *buf)
                 }
             }
         }
-        else if (!strncasecmp(header, "Content-Type", 12)) {
+        else if (!ap_casecmpstrn(header, "Content-Type", 12)) {
             ret = apr_palloc(r->pool, sizeof(meta));
             ret->start = offs+pmatch[0].rm_so;
             ret->end = offs+pmatch[0].rm_eo;
@@ -842,8 +842,8 @@ static saxctxt *check_filter_init (ap_filter_t *f)
             else if (!f->r->content_type) {
                 errmsg = "No content-type; bailing out of proxy-html filter";
             }
-            else if (strncasecmp(f->r->content_type, "text/html", 9) &&
-                     strncasecmp(f->r->content_type,
+            else if (ap_casecmpstrn(f->r->content_type, "text/html", 9) &&
+                     ap_casecmpstrn(f->r->content_type,
                                  "application/xhtml+xml", 21)) {
                 errmsg = "Non-HTML content; not inserting proxy-html filter";
             }
index a9e962315c6dc3059c1204649a4f098c92420a10..67d7e5a576150238a51c7fadae3bcab587f88c29 100644 (file)
@@ -1068,7 +1068,7 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
                     emit_H1 = 1;
                 }
             }
-            else if (!strncasecmp("text/", rr->content_type, 5)) {
+            else if (!ap_casecmpstrn("text/", rr->content_type, 5)) {
                 /*
                  * If we can open the file, prefix it with the preamble
                  * regardless; since we'll be sending a <pre> block around
@@ -1163,7 +1163,7 @@ static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble)
                     suppress_post = suppress_amble;
                 }
             }
-            else if (!strncasecmp("text/", rr->content_type, 5)) {
+            else if (!ap_casecmpstrn("text/", rr->content_type, 5)) {
                 /*
                  * If we can open the file, suppress the signature.
                  */
index 7c70119c9443d44ce26622605b916c0bca0149fd..1e398aad6fdb28d8068e53142412c2778fa29590 100644 (file)
@@ -78,7 +78,7 @@ static void discard_script_output(apr_bucket_brigade *bb);
 static int is_scriptaliased(request_rec *r)
 {
     const char *t = apr_table_get(r->notes, "alias-forced-type");
-    return t && (!strcasecmp(t, "cgi-script"));
+    return t && (!ap_casecmpstr(t, "cgi-script"));
 }
 
 /* Configuration stuff */
index 4cebd0457126b654ade2e82ea2e192b19cdb3910..7b29b2e0dac6b9253839f6a777adff56339a58ab 100644 (file)
@@ -131,7 +131,7 @@ static ap_unix_identity_t *cgid_suexec_id_doer(const request_rec *r)
 static int is_scriptaliased(request_rec *r)
 {
     const char *t = apr_table_get(r->notes, "alias-forced-type");
-    return t && (!strcasecmp(t, "cgi-script"));
+    return t && (!ap_casecmpstr(t, "cgi-script"));
 }
 
 /* Configuration stuff */
index cc11140ada6d4947c88628b03d2a48b05c72f10c..7078e308a7df6af7ceaa0d287be38f53f162c7d4 100644 (file)
@@ -101,7 +101,7 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
     }
 
     range = apr_table_get(r->headers_in, "Range");
-    if (!range || strncasecmp(range, "bytes=", 6) || r->status != HTTP_OK) {
+    if (!range || ap_casecmpstrn(range, "bytes=", 6) || r->status != HTTP_OK) {
         return 0;
     }
 
@@ -112,7 +112,7 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
 
     /* is content already a multiple range? */
     if ((ct = apr_table_get(r->headers_out, "Content-Type"))
-        && strncasecmp(ct, "multipart/byteranges", 20) == 0) {
+        && ap_casecmpstrn(ct, "multipart/byteranges", 20) == 0) {
             return 0;
     }
 
index 4304afa3a1132e3494bf59644714a96fa6b69539..c1f2a1bc4d06efc5311024a73f5a90b6cef12263 100644 (file)
@@ -317,7 +317,7 @@ apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b,
         lenp = apr_table_get(f->r->headers_in, "Content-Length");
 
         if (tenc) {
-            if (strcasecmp(tenc, "chunked") == 0 /* fast path */
+            if (ap_casecmpstr(tenc, "chunked") == 0 /* fast path */
                     || ap_find_last_token(f->r->pool, tenc, "chunked")) {
                 ctx->state = BODY_CHUNK;
             }
@@ -764,7 +764,7 @@ static int uniq_field_values(void *d, const char *key, const char *val)
          */
         for (i = 0, strpp = (char **) values->elts; i < values->nelts;
              ++i, ++strpp) {
-            if (*strpp && strcasecmp(*strpp, start) == 0) {
+            if (*strpp && ap_casecmpstr(*strpp, start) == 0) {
                 break;
             }
         }
@@ -1543,7 +1543,7 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy)
     r->remaining = 0;
 
     if (tenc) {
-        if (strcasecmp(tenc, "chunked")) {
+        if (ap_casecmpstr(tenc, "chunked")) {
             ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01592)
                           "Unknown Transfer-Encoding %s", tenc);
             return HTTP_NOT_IMPLEMENTED;
index 43a4f0822b3ced81769dba92de441bb832995c04..a02794f3194a8ad835ef9ebe93c286d0af108a72 100644 (file)
@@ -262,7 +262,7 @@ static int uniq_field_values(void *d, const char *key, const char *val)
          */
         for (i = 0, strpp = (char **) values->elts; i < values->nelts;
              ++i, ++strpp) {
-            if (*strpp && strcasecmp(*strpp, start) == 0) {
+            if (*strpp && ap_casecmpstr(*strpp, start) == 0) {
                 break;
             }
         }
index 50f7d36dd0ec9a0d656475ef4e999501589e4b2c..2a83e66da65185651bf48fbe3bb38de087e8635b 100644 (file)
@@ -497,7 +497,7 @@ static APR_INLINE char *find_multiple_headers(apr_pool_t *pool,
     result_list = rp = NULL;
 
     do {
-        if (!strcasecmp(t_elt->key, key)) {
+        if (!ap_casecmpstr(t_elt->key, key)) {
             if (!result_list) {
                 result_list = rp = apr_palloc(pool, sizeof(*rp));
             }
@@ -541,10 +541,10 @@ static const char *log_header_out(request_rec *r, char *a)
 {
     const char *cp = NULL;
 
-    if (!strcasecmp(a, "Content-type") && r->content_type) {
+    if (!ap_casecmpstr(a, "Content-type") && r->content_type) {
         cp = ap_field_noparam(r->pool, r->content_type);
     }
-    else if (!strcasecmp(a, "Set-Cookie")) {
+    else if (!ap_casecmpstr(a, "Set-Cookie")) {
         cp = find_multiple_headers(r->pool, r->headers_out, a);
     }
     else {
@@ -808,13 +808,13 @@ static const char *log_request_duration_microseconds(request_rec *r, char *a)
 static const char *log_request_duration_scaled(request_rec *r, char *a)
 {
     apr_time_t duration = get_request_end_time(r) - r->request_time;
-    if (*a == '\0' || !strcasecmp(a, "s")) {
+    if (*a == '\0' || !ap_casecmpstr(a, "s")) {
         duration = apr_time_sec(duration);
     }
-    else if (!strcasecmp(a, "ms")) {
+    else if (!ap_casecmpstr(a, "ms")) {
         duration = apr_time_as_msec(duration);
     }
-    else if (!strcasecmp(a, "us")) {
+    else if (!ap_casecmpstr(a, "us")) {
     }
     else {
         /* bogus format */
@@ -835,13 +835,13 @@ static const char *log_server_port(request_rec *r, char *a)
 {
     apr_port_t port;
 
-    if (*a == '\0' || !strcasecmp(a, "canonical")) {
+    if (*a == '\0' || !ap_casecmpstr(a, "canonical")) {
         port = r->server->port ? r->server->port : ap_default_port(r);
     }
-    else if (!strcasecmp(a, "remote")) {
+    else if (!ap_casecmpstr(a, "remote")) {
         port = r->useragent_addr->port;
     }
-    else if (!strcasecmp(a, "local")) {
+    else if (!ap_casecmpstr(a, "local")) {
         port = r->connection->local_addr->port;
     }
     else {
@@ -861,10 +861,10 @@ static const char *log_server_name(request_rec *r, char *a)
 
 static const char *log_pid_tid(request_rec *r, char *a)
 {
-    if (*a == '\0' || !strcasecmp(a, "pid")) {
+    if (*a == '\0' || !ap_casecmpstr(a, "pid")) {
         return ap_append_pid(r->pool, "", "");
     }
-    else if (!strcasecmp(a, "tid") || !strcasecmp(a, "hextid")) {
+    else if (!ap_casecmpstr(a, "tid") || !ap_casecmpstr(a, "hextid")) {
 #if APR_HAS_THREADS
         apr_os_thread_t tid = apr_os_thread_current();
 #else
@@ -1335,14 +1335,14 @@ static const char *add_custom_log(cmd_parms *cmd, void *dummy, const char *fn,
     cls->condition_var = NULL;
     cls->condition_expr = NULL;
     if (envclause != NULL) {
-        if (strncasecmp(envclause, "env=", 4) == 0) {
+        if (ap_casecmpstrn(envclause, "env=", 4) == 0) {
             if ((envclause[4] == '\0')
                 || ((envclause[4] == '!') && (envclause[5] == '\0'))) {
                 return "missing environment variable name";
             }
             cls->condition_var = apr_pstrdup(cmd->pool, &envclause[4]);
         }
-        else if (strncasecmp(envclause, "expr=", 5) == 0) {
+        else if (ap_casecmpstrn(envclause, "expr=", 5) == 0) {
             const char *err;
             if ((envclause[5] == '\0'))
                 return "missing condition";
index b506e30b8c88a678fa3264f42adc0f58abce1be3..99d8f6bdbc90d02bcf3a71aedcf906d61d37016e 100644 (file)
@@ -525,7 +525,7 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
     switch (*uri++) {
     case 'a':
     case 'A':
-        if (!strncasecmp(uri, "jp://", 5)) {        /* ajp://    */
+        if (!ap_casecmpstrn(uri, "jp://", 5)) {        /* ajp://    */
           *sqs = 1;
           return 6;
         }
@@ -533,7 +533,7 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
 
     case 'b':
     case 'B':
-        if (!strncasecmp(uri, "alancer://", 10)) {   /* balancer:// */
+        if (!ap_casecmpstrn(uri, "alancer://", 10)) {   /* balancer:// */
           *sqs = 1;
           return 11;
         }
@@ -541,10 +541,10 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
 
     case 'f':
     case 'F':
-        if (!strncasecmp(uri, "tp://", 5)) {        /* ftp://    */
+        if (!ap_casecmpstrn(uri, "tp://", 5)) {        /* ftp://    */
             return 6;
         }
-        if (!strncasecmp(uri, "cgi://", 6)) {       /* fcgi://   */
+        if (!ap_casecmpstrn(uri, "cgi://", 6)) {       /* fcgi://   */
             *sqs = 1;
             return 7;
         }
@@ -552,18 +552,18 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
 
     case 'g':
     case 'G':
-        if (!strncasecmp(uri, "opher://", 8)) {     /* gopher:// */
+        if (!ap_casecmpstrn(uri, "opher://", 8)) {     /* gopher:// */
             return 9;
         }
         break;
 
     case 'h':
     case 'H':
-        if (!strncasecmp(uri, "ttp://", 6)) {       /* http://   */
+        if (!ap_casecmpstrn(uri, "ttp://", 6)) {       /* http://   */
             *sqs = 1;
             return 7;
         }
-        else if (!strncasecmp(uri, "ttps://", 7)) { /* https://  */
+        else if (!ap_casecmpstrn(uri, "ttps://", 7)) { /* https://  */
             *sqs = 1;
             return 8;
         }
@@ -571,14 +571,14 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
 
     case 'l':
     case 'L':
-        if (!strncasecmp(uri, "dap://", 6)) {       /* ldap://   */
+        if (!ap_casecmpstrn(uri, "dap://", 6)) {       /* ldap://   */
             return 7;
         }
         break;
 
     case 'm':
     case 'M':
-        if (!strncasecmp(uri, "ailto:", 6)) {       /* mailto:   */
+        if (!ap_casecmpstrn(uri, "ailto:", 6)) {       /* mailto:   */
             *sqs = 1;
             return 7;
         }
@@ -586,17 +586,17 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
 
     case 'n':
     case 'N':
-        if (!strncasecmp(uri, "ews:", 4)) {         /* news:     */
+        if (!ap_casecmpstrn(uri, "ews:", 4)) {         /* news:     */
             return 5;
         }
-        else if (!strncasecmp(uri, "ntp://", 6)) {  /* nntp://   */
+        else if (!ap_casecmpstrn(uri, "ntp://", 6)) {  /* nntp://   */
             return 7;
         }
         break;
 
     case 's':
     case 'S':
-        if (!strncasecmp(uri, "cgi://", 6)) {       /* scgi://   */
+        if (!ap_casecmpstrn(uri, "cgi://", 6)) {       /* scgi://   */
             *sqs = 1;
             return 7;
         }
@@ -604,11 +604,11 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
 
     case 'w':
     case 'W':
-        if (!strncasecmp(uri, "s://", 4)) {        /* ws://     */
+        if (!ap_casecmpstrn(uri, "s://", 4)) {        /* ws://     */
             *sqs = 1;
             return 5;
         }
-        else if (!strncasecmp(uri, "ss://", 5)) {  /* wss://    */
+        else if (!ap_casecmpstrn(uri, "ss://", 5)) {  /* wss://    */
             *sqs = 1;
             return 6;
         }
@@ -716,7 +716,7 @@ static char *escape_absolute_uri(apr_pool_t *p, char *uri, unsigned scheme)
          *               [dn ["?" [attributes] ["?" [scope]
          *               ["?" [filter] ["?" extensions]]]]]]
          */
-        if (!strncasecmp(uri, "ldap", 4)) {
+        if (!ap_casecmpstrn(uri, "ldap", 4)) {
             char *token[5];
             int c = 0;
 
@@ -1576,7 +1576,7 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin,
     }
 
     /* catch the "failed" case */
-    if (i == 4 && !strcasecmp(buf, "NULL")) {
+    if (i == 4 && !ap_casecmpstr(buf, "NULL")) {
         return NULL;
     }
 
@@ -1829,7 +1829,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
 
     /* fast tests for variable length variables (sic) first */
     if (var[3] == ':') {
-        if (var[4] && !strncasecmp(var, "ENV", 3)) {
+        if (var[4] && !ap_casecmpstrn(var, "ENV", 3)) {
             var += 4;
             result = apr_table_get(r->notes, var);
 
@@ -1840,7 +1840,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
                 result = getenv(var);
             }
         }
-        else if (var[4] && !strncasecmp(var, "SSL", 3) && rewrite_ssl_lookup) {
+        else if (var[4] && !ap_casecmpstrn(var, "SSL", 3) && rewrite_ssl_lookup) {
             result = rewrite_ssl_lookup(r->pool, r->server, r->connection, r,
                                         var + 4);
         }
@@ -1850,10 +1850,10 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
             request_rec *rr;
             const char *path;
 
-            if (!strncasecmp(var, "HTTP", 4)) {
+            if (!ap_casecmpstrn(var, "HTTP", 4)) {
                 result = lookup_header(var+5, ctx);
             }
-            else if (!strncasecmp(var, "LA-U", 4)) {
+            else if (!ap_casecmpstrn(var, "LA-U", 4)) {
                 if (ctx->uri && subreq_ok(r)) {
                     path = ctx->perdir ? la_u(ctx) : ctx->uri;
                     rr = ap_sub_req_lookup_uri(path, r, NULL);
@@ -1868,7 +1868,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
                     return (char *)result;
                 }
             }
-            else if (!strncasecmp(var, "LA-F", 4)) {
+            else if (!ap_casecmpstrn(var, "LA-F", 4)) {
                 if (ctx->uri && subreq_ok(r)) {
                     path = ctx->uri;
                     if (ctx->perdir && *path == '/') {
@@ -2575,14 +2575,14 @@ static void add_cookie(request_rec *r, char *s)
                                  : NULL,
                                  expires ? (exp_time ? exp_time : "")
                                  : NULL,
-                                 (secure && (!strcasecmp(secure, "true")
+                                 (secure && (!ap_casecmpstr(secure, "true")
                                              || !strcmp(secure, "1")
-                                             || !strcasecmp(secure,
+                                             || !ap_casecmpstr(secure,
                                                             "secure"))) ?
                                   "; secure" : NULL,
-                                 (httponly && (!strcasecmp(httponly, "true")
+                                 (httponly && (!ap_casecmpstr(httponly, "true")
                                                || !strcmp(httponly, "1")
-                                               || !strcasecmp(httponly,
+                                               || !ap_casecmpstr(httponly,
                                                               "HttpOnly"))) ?
                                   "; HttpOnly" : NULL,
                                  NULL);
index 09a41e1cc692bad47ee4300d762accc7fe68dd23..8cdeb3e7b9092ae1ea1d0bba977c4a21a953aa93 100644 (file)
@@ -240,7 +240,7 @@ static int scan_meta_file(request_rec *r, apr_file_t *f)
         while (apr_isspace(*l))
             ++l;
 
-        if (!strcasecmp(w, "Content-type")) {
+        if (!ap_casecmpstr(w, "Content-type")) {
             char *tmp;
             /* Nuke trailing whitespace */
 
@@ -252,7 +252,7 @@ static int scan_meta_file(request_rec *r, apr_file_t *f)
             ap_content_type_tolower(tmp);
             ap_set_content_type(r, tmp);
         }
-        else if (!strcasecmp(w, "Status")) {
+        else if (!ap_casecmpstr(w, "Status")) {
             sscanf(l, "%d", &r->status);
             r->status_line = apr_pstrdup(r->pool, l);
         }
index 210b2bbb5759f48ebbb8006e9701671b5db4147e..a21f71efd0e51d31f3abbbc5532cb1ec7e592364 100644 (file)
@@ -789,14 +789,14 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
             }
             break;
         case hdr_set:
-            if (!strcasecmp(hdr->header, "Content-Type")) {
+            if (!ap_casecmpstr(hdr->header, "Content-Type")) {
                  ap_set_content_type(r, process_tags(hdr, r));
             }
             apr_table_setn(headers, hdr->header, process_tags(hdr, r));
             break;
         case hdr_setifempty:
             if (NULL == apr_table_get(headers, hdr->header)) {
-                if (!strcasecmp(hdr->header, "Content-Type")) {
+                if (!ap_casecmpstr(hdr->header, "Content-Type")) {
                     ap_set_content_type(r, process_tags(hdr, r));
                 }
                 apr_table_setn(headers, hdr->header, process_tags(hdr, r));
@@ -813,7 +813,7 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
             break;
         case hdr_edit:
         case hdr_edit_r:
-            if (!strcasecmp(hdr->header, "Content-Type") && r->content_type) {
+            if (!ap_casecmpstr(hdr->header, "Content-Type") && r->content_type) {
                 const char *repl = process_regexp(hdr, r->content_type, r);
                 if (repl == NULL)
                     return 0;
index 0ec94ad7806ad5a6f1d59110f0212930bdb6d931..dff06567fee1195ffa47b880990bcdb65faed1a3 100644 (file)
@@ -633,15 +633,15 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
         }
 
         /* Set-Cookie need additional processing */
-        if (!strcasecmp(stringname, "Set-Cookie")) {
+        if (!ap_casecmpstr(stringname, "Set-Cookie")) {
             value = ap_proxy_cookie_reverse_map(r, dconf, value);
         }
         /* Location, Content-Location, URI and Destination need additional
          * processing */
-        else if (!strcasecmp(stringname, "Location")
-                 || !strcasecmp(stringname, "Content-Location")
-                 || !strcasecmp(stringname, "URI")
-                 || !strcasecmp(stringname, "Destination"))
+        else if (!ap_casecmpstr(stringname, "Location")
+                 || !ap_casecmpstr(stringname, "Content-Location")
+                 || !ap_casecmpstr(stringname, "URI")
+                 || !ap_casecmpstr(stringname, "Destination"))
         {
           value = ap_proxy_location_reverse_map(r, dconf, value);
         }
@@ -654,7 +654,7 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
         apr_table_add(r->headers_out, stringname, value);
 
         /* Content-type needs an additional handling */
-        if (strcasecmp(stringname, "Content-Type") == 0) {
+        if (ap_casecmpstr(stringname, "Content-Type") == 0) {
              /* add corresponding filter */
             ap_set_content_type(r, apr_pstrdup(r->pool, value));
             ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r,
index d9381332b5dc59a6c3431f544b79ba1de9be09f1..a949afb3ccc866082c6071d892a1b4ee75b87b64 100644 (file)
@@ -1105,9 +1105,9 @@ static int proxy_handler(request_rec *r)
                 if (strcmp(ents[i].scheme, "*") == 0 ||
                     (ents[i].use_regex &&
                      ap_regexec(ents[i].regexp, url, 0, NULL, 0) == 0) ||
-                    (p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
+                    (p2 == NULL && ap_casecmpstr(scheme, ents[i].scheme) == 0) ||
                     (p2 != NULL &&
-                    strncasecmp(url, ents[i].scheme,
+                    ap_casecmpstrn(url, ents[i].scheme,
                                 strlen(ents[i].scheme)) == 0)) {
 
                     /* handle the scheme */
@@ -1593,7 +1593,7 @@ PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url)
      * We could be passed a URL during the config stage that contains
      * the UDS path... ignore it
      */
-    if (!strncasecmp(url, "unix:", 5) &&
+    if (!ap_casecmpstrn(url, "unix:", 5) &&
         ((ptr = ap_strchr_c(url, '|')) != NULL)) {
         /* move past the 'unix:...|' UDS path info */
         const char *ret, *c;
index ece475ddf687eabf8f44304b751c3439b50b9a88..0a6ea595a1f696d1ef19142d06e2baaee14865be 100644 (file)
@@ -35,7 +35,7 @@ static int proxy_ajp_canon(request_rec *r, char *url)
     apr_port_t port, def_port;
 
     /* ap_port_of_scheme() */
-    if (strncasecmp(url, "ajp:", 4) == 0) {
+    if (ap_casecmpstrn(url, "ajp:", 4) == 0) {
         url += 4;
     }
     else {
@@ -243,7 +243,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
     /* read the first bloc of data */
     input_brigade = apr_brigade_create(p, r->connection->bucket_alloc);
     tenc = apr_table_get(r->headers_in, "Transfer-Encoding");
-    if (tenc && (strcasecmp(tenc, "chunked") == 0)) {
+    if (tenc && (ap_casecmpstr(tenc, "chunked") == 0)) {
         /* The AJP protocol does not want body data yet */
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00870) "request is chunked");
     } else {
@@ -746,7 +746,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
     apr_pool_t *p = r->pool;
     apr_uri_t *uri;
 
-    if (strncasecmp(url, "ajp:", 4) != 0) {
+    if (ap_casecmpstrn(url, "ajp:", 4) != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00894) "declining URL %s", url);
         return DECLINED;
     }
index 67295be3abe76160d282ed5cb246f8b17723208d..d9e69ca288325f39188a157563f89898efaf4cc2 100644 (file)
@@ -63,7 +63,7 @@ static int proxy_balancer_canon(request_rec *r, char *url)
     apr_port_t port = 0;
 
     /* TODO: offset of BALANCER_PREFIX ?? */
-    if (strncasecmp(url, "balancer:", 9) == 0) {
+    if (ap_casecmpstrn(url, "balancer:", 9) == 0) {
         url += 9;
     }
     else {
@@ -1380,7 +1380,7 @@ static int balancer_handler(request_rec *r)
                 ap_rprintf(r, "          <httpd:lbset>%d</httpd:lbset>\n",
                            worker->s->lbset);
                 /* End proxy_worker_stat */
-                if (!strcasecmp(worker->s->scheme, "ajp")) {
+                if (!ap_casecmpstr(worker->s->scheme, "ajp")) {
                     ap_rputs("          <httpd:flushpackets>", r);
                     switch (worker->s->flush_packets) {
                         case flush_off:
index ba813ed50029e8b76aa8bd64348768955df74f63..48dc81f13ebd13a847259005ced3f437c4deea6c 100644 (file)
@@ -39,7 +39,7 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
     fcgi_req_config_t *rconf = NULL;
     const char *pathinfo_type = NULL;
 
-    if (strncasecmp(url, "fcgi:", 5) == 0) {
+    if (ap_casecmpstrn(url, "fcgi:", 5) == 0) {
         url += 5;
     }
     else {
@@ -878,7 +878,7 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
                   "url: %s proxyname: %s proxyport: %d",
                  url, proxyname, proxyport);
 
-    if (strncasecmp(url, "fcgi:", 5) != 0) {
+    if (ap_casecmpstrn(url, "fcgi:", 5) != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url);
         return DECLINED;
     }
index 63cf469664c4dbe4898985e46a5eb36e39527aec..6f550c0e3760554b4f97e33ceb6834bae497b893 100644 (file)
@@ -32,7 +32,7 @@ static int proxy_fdpass_canon(request_rec *r, char *url)
 {
     const char *path;
 
-    if (strncasecmp(url, "fd://", 5) == 0) {
+    if (ap_casecmpstrn(url, "fd://", 5) == 0) {
         url += 5;
     }
     else {
@@ -132,7 +132,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
     apr_socket_t *sock;
     apr_socket_t *clientsock;
 
-    if (strncasecmp(url, "fd://", 5) == 0) {
+    if (ap_casecmpstrn(url, "fd://", 5) == 0) {
         url += 5;
     }
     else {
index 934cb2b8e60c62e8a87f65522aec3e3057ed9cf7..7e0341a52a1c309089cd7ae894a2850c737bc2a3 100644 (file)
@@ -294,7 +294,7 @@ static int proxy_ftp_canon(request_rec *r, char *url)
     apr_port_t port, def_port;
 
     /* */
-    if (strncasecmp(url, "ftp:", 4) == 0) {
+    if (ap_casecmpstrn(url, "ftp:", 4) == 0) {
         url += 4;
     }
     else {
@@ -494,7 +494,7 @@ static apr_status_t proxy_send_dir_filter(ap_filter_t *f,
         path = apr_uri_unparse(p, &f->r->parsed_uri, APR_URI_UNP_OMITSITEPART | APR_URI_UNP_OMITQUERY);
 
         /* If path began with /%2f, change the basedir */
-        if (strncasecmp(path, "/%2f", 4) == 0) {
+        if (ap_casecmpstrn(path, "/%2f", 4) == 0) {
             basedir = "/%2f";
         }
 
@@ -1011,7 +1011,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
                       proxyhost);
         return DECLINED;        /* proxy connections are via HTTP */
     }
-    if (strncasecmp(url, "ftp:", 4)) {
+    if (ap_casecmpstrn(url, "ftp:", 4)) {
         ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
                       "declining URL %s - not ftp:", url);
         return DECLINED;        /* only interested in FTP */
@@ -1082,7 +1082,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
      * still smaller that the URL is logged regularly.
      */
     if ((password = apr_table_get(r->headers_in, "Authorization")) != NULL
-        && strcasecmp(ap_getword(r->pool, &password, ' '), "Basic") == 0
+        && ap_casecmpstr(ap_getword(r->pool, &password, ' '), "Basic") == 0
         && (password = ap_pbase64decode(r->pool, password))[0] != ':') {
         /* Check the decoded string for special characters. */
         if (!ftp_check_string(password)) {
@@ -1328,7 +1328,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
     /* Special handling for leading "%2f": this enforces a "cwd /"
      * out of the $HOME directory which was the starting point after login
      */
-    if (strncasecmp(path, "%2f", 3) == 0) {
+    if (ap_casecmpstrn(path, "%2f", 3) == 0) {
         path += 3;
         while (*path == '/') /* skip leading '/' (after root %2f) */
             ++path;
index 8c048ecbabfa037354c9cd465b8693a9619cc62d..c367604b499853be8a02a49563cf72a3d9e2affd 100644 (file)
@@ -43,11 +43,11 @@ static int proxy_http_canon(request_rec *r, char *url)
     apr_port_t port, def_port;
 
     /* ap_port_of_scheme() */
-    if (strncasecmp(url, "http:", 5) == 0) {
+    if (ap_casecmpstrn(url, "http:", 5) == 0) {
         url += 5;
         scheme = "http";
     }
-    else if (strncasecmp(url, "https:", 6) == 0) {
+    else if (ap_casecmpstrn(url, "https:", 6) == 0) {
         url += 6;
         scheme = "https";
     }
@@ -792,7 +792,7 @@ static int ap_proxy_http_prefetch(apr_pool_t *p, request_rec *r,
      * encoding has been done by the extensions' handler, and
      * do not modify add_te_chunked's logic
      */
-    if (*old_te_val && strcasecmp(*old_te_val, "chunked") != 0) {
+    if (*old_te_val && ap_casecmpstr(*old_te_val, "chunked") != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01093)
                       "%s Transfer-Encoding is not supported", *old_te_val);
         return HTTP_INTERNAL_SERVER_ERROR;
@@ -1113,14 +1113,14 @@ static void process_proxy_header(request_rec *r, proxy_dir_conf *c,
     };
     int i;
     for (i = 0; date_hdrs[i]; ++i) {
-        if (!strcasecmp(date_hdrs[i], key)) {
+        if (!ap_casecmpstr(date_hdrs[i], key)) {
             apr_table_add(r->headers_out, key,
                           date_canon(r->pool, value));
             return;
         }
     }
     for (i = 0; transform_hdrs[i].name; ++i) {
-        if (!strcasecmp(transform_hdrs[i].name, key)) {
+        if (!ap_casecmpstr(transform_hdrs[i].name, key)) {
             apr_table_add(r->headers_out, key,
                           (*transform_hdrs[i].func)(r, c, value));
             return;
index 2cbe8483f34099ecd7a3f7df666d956fe2d93f1f..224d1ef123334f4de7f42c8104fc2a1c8884eb88 100644 (file)
@@ -180,7 +180,7 @@ static int scgi_canon(request_rec *r, char *url)
     const char *err, *path;
     apr_port_t port, def_port;
 
-    if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
+    if (ap_casecmpstrn(url, SCHEME "://", sizeof(SCHEME) + 2)) {
         return DECLINED;
     }
     url += sizeof(SCHEME); /* Keep slashes */
@@ -434,7 +434,7 @@ static int pass_response(request_rec *r, proxy_conn_rec *conn)
         if (location && *location == '/') {
             scgi_request_config *req_conf = apr_palloc(r->pool,
                                                        sizeof(*req_conf));
-            if (strcasecmp(location_header, "Location")) {
+            if (ap_casecmpstr(location_header, "Location")) {
                 if (err) {
                     apr_table_unset(r->err_headers_out, location_header);
                 }
@@ -533,7 +533,7 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
     apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
     char dummy;
 
-    if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
+    if (ap_casecmpstrn(url, SCHEME "://", sizeof(SCHEME) + 2)) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00865)
                       "declining URL %s", url);
         return DECLINED;
index 1602cbbb710848b3e534220defae70b28271a66b..56a01e68d95ffd379018b74588c13ff22c7e026f 100644 (file)
@@ -211,12 +211,12 @@ static int proxy_wstunnel_canon(request_rec *r, char *url)
     apr_port_t port, def_port;
 
     /* ap_port_of_scheme() */
-    if (strncasecmp(url, "ws:", 3) == 0) {
+    if (ap_casecmpstrn(url, "ws:", 3) == 0) {
         url += 3;
         scheme = "ws:";
         def_port = apr_uri_port_of_scheme("http");
     }
-    else if (strncasecmp(url, "wss:", 4) == 0) {
+    else if (ap_casecmpstrn(url, "wss:", 4) == 0) {
         url += 4;
         scheme = "wss:";
         def_port = apr_uri_port_of_scheme("https");
@@ -474,11 +474,11 @@ static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
     apr_uri_t *uri;
     int is_ssl = 0;
 
-    if (strncasecmp(url, "wss:", 4) == 0) {
+    if (ap_casecmpstrn(url, "wss:", 4) == 0) {
         scheme = "WSS";
         is_ssl = 1;
     }
-    else if (strncasecmp(url, "ws:", 3) == 0) {
+    else if (ap_casecmpstrn(url, "ws:", 3) == 0) {
         scheme = "WS";
     }
     else {
@@ -487,7 +487,7 @@ static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
     }
 
     upgrade = apr_table_get(r->headers_in, "Upgrade");
-    if (!upgrade || strcasecmp(upgrade, "WebSocket") != 0) {
+    if (!upgrade || ap_casecmpstr(upgrade, "WebSocket") != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02900)
                       "declining URL %s  (not WebSocket)", url);
         return DECLINED;
index 520885b75c9053889c231717c465174e984d6ea6..47cde1584bc7ba7174b7d157d5ff9221fa1ca8a3 100644 (file)
@@ -151,40 +151,40 @@ static int copy_headers_in(void *vbaton, const char *key, const char *value)
     switch (key[0]) {
     case 'a':
     case 'A':
-        if (strcasecmp("Accept-Encoding", key) == 0) {
+        if (ap_casecmpstr("Accept-Encoding", key) == 0) {
             return 0;
         }
         break;
     case 'c':
     case 'C':
-        if (strcasecmp("Connection", key) == 0) {
+        if (ap_casecmpstr("Connection", key) == 0) {
             return 0;
         }
         break;
     case 'h':
     case 'H':
-        if (strcasecmp("Host", key) == 0) {
+        if (ap_casecmpstr("Host", key) == 0) {
             return 0;
         }
         break;
     case 'k':
     case 'K':
-        if (strcasecmp("Keep-Alive", key) == 0) {
+        if (ap_casecmpstr("Keep-Alive", key) == 0) {
             return 0;
         }
         break;
     case 't':
     case 'T':
-        if (strcasecmp("TE", key) == 0) {
+        if (ap_casecmpstr("TE", key) == 0) {
             return 0;
         }
-        if (strcasecmp("Trailer", key) == 0) {
+        if (ap_casecmpstr("Trailer", key) == 0) {
             return 0;
         }
         break;
     case 'u':
     case 'U':
-        if (strcasecmp("Upgrade", key) == 0) {
+        if (ap_casecmpstr("Upgrade", key) == 0) {
             return 0;
         }
         break;
@@ -205,27 +205,27 @@ static int copy_headers_out(void *vbaton, const char *key, const char *value)
     switch (key[0]) {
     case 'c':
     case 'C':
-        if (strcasecmp("Content-Type", key) == 0) {
+        if (ap_casecmpstr("Content-Type", key) == 0) {
             ap_set_content_type(ctx->r, value);
             done = 1;
             break;
         }
-        else if (strcasecmp("Connection", key) == 0) {
+        else if (ap_casecmpstr("Connection", key) == 0) {
             done = 1;
             break;
         }
-        else if (strcasecmp("Content-Encoding", key) == 0) {
+        else if (ap_casecmpstr("Content-Encoding", key) == 0) {
             done = 1;
             break;
         }
-        else if (strcasecmp("Content-Length", key) == 0) {
+        else if (ap_casecmpstr("Content-Length", key) == 0) {
             done = 1;
             break;
         }
         break;
     case 't':
     case 'T':
-        if (strcasecmp("Transfer-Encoding", key) == 0) {
+        if (ap_casecmpstr("Transfer-Encoding", key) == 0) {
             done = 1;
             break;
         }
@@ -512,7 +512,7 @@ static int drive_serf(request_rec *r, serf_config_t *conf)
     baton->done_headers = 0;
     baton->keep_reading = 1;
 
-    if (strcasecmp(conf->url.scheme, "https") == 0) {
+    if (ap_casecmpstr(conf->url.scheme, "https") == 0) {
         baton->want_ssl = 1;
     }
     else {
index 4f5db685e837c7892b416ea0606ca6c58ab4e024..5dd0ce0d259ba04b0df345b591fcd649b1e5a694 100644 (file)
@@ -1074,7 +1074,7 @@ PROXY_DECLARE(int) ap_proxy_valid_balancer_name(char *name, int i)
 {
     if (!i)
         i = sizeof(BALANCER_PREFIX)-1;
-    return (!strncasecmp(name, BALANCER_PREFIX, i));
+    return (!ap_casecmpstrn(name, BALANCER_PREFIX, i));
 }
 
 
@@ -1677,7 +1677,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
     if (ptr) {
         *ptr = '\0';
         rv = apr_uri_parse(p, url, &urisock);
-        if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "unix")) {
+        if (rv == APR_SUCCESS && !ap_casecmpstr(urisock.scheme, "unix")) {
             sockpath = ap_runtime_dir_relative(p, urisock.path);;
             url = ptr+1;    /* so we get the scheme for the uds */
         }
@@ -3330,7 +3330,7 @@ static int ap_proxy_clear_connection(request_rec *r, apr_table_t *headers)
             ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02807)
                           "Removing header '%s' listed in Connection header",
                           name);
-            if (!strcasecmp(name, "close")) {
+            if (!ap_casecmpstr(name, "close")) {
                 closed = 1;
             }
             apr_table_unset(headers, name);
@@ -3494,7 +3494,7 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
 
         /* Add the Expect header if not already there. */
         if (((val = apr_table_get(r->headers_in, "Expect")) == NULL)
-                || (strcasecmp(val, "100-Continue") != 0 /* fast path */
+                || (ap_casecmpstr(val, "100-Continue") != 0 /* fast path */
                     && !ap_find_token(r->pool, val, "100-Continue"))) {
             apr_table_mergen(r->headers_in, "Expect", "100-Continue");
         }
@@ -3559,15 +3559,15 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
             || headers_in[counter].val == NULL
 
             /* Already sent */
-            || !strcasecmp(headers_in[counter].key, "Host")
+            || !ap_casecmpstr(headers_in[counter].key, "Host")
 
             /* Clear out hop-by-hop request headers not to send
              * RFC2616 13.5.1 says we should strip these headers
              */
-            || !strcasecmp(headers_in[counter].key, "Keep-Alive")
-            || !strcasecmp(headers_in[counter].key, "TE")
-            || !strcasecmp(headers_in[counter].key, "Trailer")
-            || !strcasecmp(headers_in[counter].key, "Upgrade")
+            || !ap_casecmpstr(headers_in[counter].key, "Keep-Alive")
+            || !ap_casecmpstr(headers_in[counter].key, "TE")
+            || !ap_casecmpstr(headers_in[counter].key, "Trailer")
+            || !ap_casecmpstr(headers_in[counter].key, "Upgrade")
 
             ) {
             continue;
@@ -3577,7 +3577,7 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
          * If we have used it then MAYBE: RFC2616 says we MAY propagate it.
          * So let's make it configurable by env.
          */
-        if (!strcasecmp(headers_in[counter].key,"Proxy-Authorization")) {
+        if (!ap_casecmpstr(headers_in[counter].key,"Proxy-Authorization")) {
             if (r->user != NULL) { /* we've authenticated */
                 if (!apr_table_get(r->subprocess_env, "Proxy-Chain-Auth")) {
                     continue;
@@ -3587,22 +3587,22 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
 
         /* Skip Transfer-Encoding and Content-Length for now.
          */
-        if (!strcasecmp(headers_in[counter].key, "Transfer-Encoding")) {
+        if (!ap_casecmpstr(headers_in[counter].key, "Transfer-Encoding")) {
             *old_te_val = headers_in[counter].val;
             continue;
         }
-        if (!strcasecmp(headers_in[counter].key, "Content-Length")) {
+        if (!ap_casecmpstr(headers_in[counter].key, "Content-Length")) {
             *old_cl_val = headers_in[counter].val;
             continue;
         }
 
         /* for sub-requests, ignore freshness/expiry headers */
         if (r->main) {
-            if (   !strcasecmp(headers_in[counter].key, "If-Match")
-                || !strcasecmp(headers_in[counter].key, "If-Modified-Since")
-                || !strcasecmp(headers_in[counter].key, "If-Range")
-                || !strcasecmp(headers_in[counter].key, "If-Unmodified-Since")
-                || !strcasecmp(headers_in[counter].key, "If-None-Match")) {
+            if (   !ap_casecmpstr(headers_in[counter].key, "If-Match")
+                || !ap_casecmpstr(headers_in[counter].key, "If-Modified-Since")
+                || !ap_casecmpstr(headers_in[counter].key, "If-Range")
+                || !ap_casecmpstr(headers_in[counter].key, "If-Unmodified-Since")
+                || !ap_casecmpstr(headers_in[counter].key, "If-None-Match")) {
                 continue;
             }
         }
@@ -3687,7 +3687,7 @@ PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme)
         } else {
             proxy_schemes_t *pscheme;
             for (pscheme = pschemes; pscheme->name != NULL; ++pscheme) {
-                if (strcasecmp(scheme, pscheme->name) == 0) {
+                if (ap_casecmpstr(scheme, pscheme->name) == 0) {
                     return pscheme->default_port;
                 }
             }
index 4f0eeeaeb91993dc66e0acd594cfcb6af708c813..27a0732f5e41318013e458427f93f69020a77a7d 100644 (file)
@@ -111,7 +111,7 @@ static int slotmem_filenames(apr_pool_t *pool,
 {
     const char *fname = NULL, *pname = NULL;
 
-    if (slotname && *slotname && strcasecmp(slotname, "none") != 0) {
+    if (slotname && *slotname && ap_casecmpstr(slotname, "none") != 0) {
         if (slotname[0] != '/') {
 #if !SLOTMEM_UNLINK_SEMANTIC
             /* Each generation needs its own file name. */
index 74dcd8a2e9e2a97e6cdcf414c684ed21e89a1232..18c0e74a6ddfec46fb3d9b6d860d1516d6fd367f 100644 (file)
@@ -544,12 +544,7 @@ static apr_status_t policy_nocache_out_filter(ap_filter_t *f,
             char *header = apr_pstrdup(r->pool, pragma_header);
             const char *token = apr_strtok(header, ", ", &last);
             while (token) {
-                /* handle most common quickest case... */
-                if (!strcmp(token, "no-cache")) {
-                    fail = 1;
-                }
-                /* ...then try slowest case */
-                else if (!strcasecmp(token, "no-cache")) {
+                if (!ap_casecmpstr(token, "no-cache")) {
                     fail = 1;
                 }
                 token = apr_strtok(NULL, ", ", &last);
@@ -563,15 +558,7 @@ static apr_status_t policy_nocache_out_filter(ap_filter_t *f,
                 switch (token[0]) {
                 case 'n':
                 case 'N': {
-                    /* handle most common quickest cases... */
-                    if (!strcmp(token, "no-cache")) {
-                        fail = 1;
-                    }
-                    else if (!strcmp(token, "no-store")) {
-                        fail = 1;
-                    }
-                    /* ...then try slowest cases */
-                    else if (!strncasecmp(token, "no-cache", 8)) {
+                    if (!ap_casecmpstrn(token, "no-cache", 8)) {
                         if (token[8] == '=') {
                         }
                         else if (!token[8]) {
@@ -579,19 +566,14 @@ static apr_status_t policy_nocache_out_filter(ap_filter_t *f,
                         }
                         break;
                     }
-                    else if (!strcasecmp(token, "no-store")) {
+                    else if (!ap_casecmpstr(token, "no-store")) {
                         fail = 1;
                     }
                     break;
                 }
                 case 'p':
                 case 'P': {
-                    /* handle most common quickest cases... */
-                    if (!strcmp(token, "private")) {
-                        fail = 1;
-                    }
-                    /* ...then try slowest cases */
-                    else if (!strncasecmp(token, "private", 7)) {
+                    if (!ap_casecmpstrn(token, "private", 7)) {
                         if (token[7] == '=') {
                         }
                         else if (!token[7]) {
@@ -662,13 +644,7 @@ static apr_status_t policy_maxage_out_filter(ap_filter_t *f,
                 switch (token[0]) {
                 case 'm':
                 case 'M': {
-                    /* handle most common quickest cases... */
-                    if (!strncmp(token, "max-age", 7)) {
-                        max_age = 1;
-                        max_age_value = apr_atoi64(token + 8);
-                    }
-                    /* ...then try slowest cases */
-                    else if (!strncasecmp(token, "max-age", 7)) {
+                    if (!ap_casecmpstrn(token, "max-age", 7)) {
                         if (token[7] == '=') {
                             max_age = 1;
                             max_age_value = apr_atoi64(token + 8);
@@ -679,14 +655,7 @@ static apr_status_t policy_maxage_out_filter(ap_filter_t *f,
                 }
                 case 's':
                 case 'S': {
-                    if (!strncmp(token, "s-maxage", 8)) {
-                        if (token[8] == '=') {
-                            s_maxage = 1;
-                            s_maxage_value = apr_atoi64(token + 9);
-                        }
-                        break;
-                    }
-                    else if (!strncasecmp(token, "s-maxage", 8)) {
+                    if (!ap_casecmpstrn(token, "s-maxage", 8)) {
                         if (token[8] == '=') {
                             s_maxage = 1;
                             s_maxage_value = apr_atoi64(token + 9);
index 1a7f9359c73b51e0a7dbe178f15114f0464baf7c..b5f48742333ea176be52f7c14618ab43629d3896 100644 (file)
@@ -627,7 +627,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
      * expensive to do correctly (performing a complete SSL handshake)
      * or cause log spam by doing incorrectly (simply sending EOF). */
     lp = ap_listeners;
-    while (lp && lp->protocol && strcasecmp(lp->protocol, "http") != 0) {
+    while (lp && lp->protocol && ap_casecmpstr(lp->protocol, "http") != 0) {
         lp = lp->next;
     }
     if (!lp) {
@@ -675,7 +675,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
         return rv;
     }
 
-    if (lp->protocol && strcasecmp(lp->protocol, "https") == 0) {
+    if (lp->protocol && ap_casecmpstr(lp->protocol, "https") == 0) {
         /* Send a TLS 1.0 close_notify alert.  This is perhaps the
          * "least wrong" way to open and cleanly terminate an SSL
          * connection.  It should "work" without noisy error logs if
index 810d3b056bed0ff4d35457dec62601dc98595945..c471644b9cfe0f479d3982f191ca6cafb5bc1fda 100644 (file)
@@ -526,7 +526,7 @@ AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri)
     if (status == APR_SUCCESS) {
         /* if it has a scheme we may need to do absoluteURI vhost stuff */
         if (r->parsed_uri.scheme
-            && !strcasecmp(r->parsed_uri.scheme, ap_http_scheme(r))) {
+            && !ap_casecmpstr(r->parsed_uri.scheme, ap_http_scheme(r))) {
             r->hostname = r->parsed_uri.hostname;
         }
         else if (r->method_number == M_CONNECT) {
@@ -692,7 +692,7 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
             }
         }
         if (3 == sscanf(r->protocol, "%4s/%u.%u", http, &major, &minor)
-            && (strcasecmp("http", http) == 0)
+            && (ap_casecmpstr("http", http) == 0)
             && (minor < HTTP_VERSION(1, 0)) ) { /* don't allow HTTP/0.1000 */
             r->proto_num = HTTP_VERSION(major, minor);
         }
@@ -1133,7 +1133,7 @@ request_rec *ap_read_request(conn_rec *conn)
              * the final encoding ...; the server MUST respond with the 400
              * (Bad Request) status code and then close the connection".
              */
-            if (!(strcasecmp(tenc, "chunked") == 0 /* fast path */
+            if (!(ap_casecmpstr(tenc, "chunked") == 0 /* fast path */
                     || ap_find_last_token(r->pool, tenc, "chunked"))) {
                 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02539)
                               "client sent unknown Transfer-Encoding "
@@ -1238,7 +1238,7 @@ request_rec *ap_read_request(conn_rec *conn)
          * unfortunately, to signal a poor man's mandatory extension that
          * the server must understand or return 417 Expectation Failed.
          */
-        if (strcasecmp(expect, "100-continue") == 0) {
+        if (ap_casecmpstr(expect, "100-continue") == 0) {
             r->expecting_100 = 1;
         }
         else {
@@ -1418,7 +1418,7 @@ AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw)
                                               : "Authorization");
     const char *t;
 
-    if (!(t = ap_auth_type(r)) || strcasecmp(t, "Basic"))
+    if (!(t = ap_auth_type(r)) || ap_casecmpstr(t, "Basic"))
         return DECLINED;
 
     if (!ap_auth_name(r)) {
@@ -1432,7 +1432,7 @@ AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw)
         return HTTP_UNAUTHORIZED;
     }
 
-    if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) {
+    if (ap_casecmpstr(ap_getword(r->pool, &auth_line, ' '), "Basic")) {
         /* Client tried to authenticate using wrong auth scheme */
         ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00573)
                       "client used wrong authentication scheme: %s", r->uri);
index c4316c7bfbb23f3c908b6ac2e7873f19980fee6f..76b7e2c9579f79f447ef9856a508e1ba19f87003 100644 (file)
@@ -1609,7 +1609,7 @@ AP_DECLARE(int) ap_find_token(apr_pool_t *p, const char *line, const char *tok)
         while (*s && !TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) {
             ++s;
         }
-        if (!strncasecmp((const char *)start_token, (const char *)tok,
+        if (!ap_casecmpstrn((const char *)start_token, (const char *)tok,
                          s - start_token)) {
             return 1;
         }
@@ -1636,7 +1636,7 @@ AP_DECLARE(int) ap_find_last_token(apr_pool_t *p, const char *line,
         (lidx > 0 && !(apr_isspace(line[lidx - 1]) || line[lidx - 1] == ',')))
         return 0;
 
-    return (strncasecmp(&line[lidx], tok, tlen) == 0);
+    return (ap_casecmpstrn(&line[lidx], tok, tlen) == 0);
 }
 
 AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *str)
@@ -2603,7 +2603,7 @@ AP_DECLARE(int) ap_parse_form_data(request_rec *r, ap_filter_t *f,
 
     /* sanity check - we only support forms for now */
     ct = apr_table_get(r->headers_in, "Content-Type");
-    if (!ct || strncasecmp("application/x-www-form-urlencoded", ct, 33)) {
+    if (!ct || ap_casecmpstrn("application/x-www-form-urlencoded", ct, 33)) {
         return ap_discard_request_body(r);
     }
 
index 9b569bd132ffa36446ede679c7021567a5cdd926..08ba66a4102e2a47bf748818c29ff4adff26605d 100644 (file)
@@ -1710,13 +1710,13 @@ static int op_T(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg)
         return FALSE;
     case 'o':
     case 'O':
-        return strcasecmp(arg, "off") == 0 ? FALSE : TRUE;
+        return ap_casecmpstr(arg, "off") == 0 ? FALSE : TRUE;
     case 'n':
     case 'N':
-        return strcasecmp(arg, "no") == 0 ? FALSE : TRUE;
+        return ap_casecmpstr(arg, "no") == 0 ? FALSE : TRUE;
     case 'f':
     case 'F':
-        return strcasecmp(arg, "false") == 0 ? FALSE : TRUE;
+        return ap_casecmpstr(arg, "false") == 0 ? FALSE : TRUE;
     case '0':
         return arg[1] == '\0' ? FALSE : TRUE;
     default:
@@ -1824,7 +1824,7 @@ static int core_expr_lookup(ap_expr_lookup_parms *parms)
             while (prov->func) {
                 const char **name = prov->names;
                 while (*name) {
-                    if (strcasecmp(*name, parms->name) == 0) {
+                    if (ap_casecmpstr(*name, parms->name) == 0) {
                         *parms->func = prov->func;
                         *parms->data = name;
                         return OK;
@@ -1857,7 +1857,7 @@ static int core_expr_lookup(ap_expr_lookup_parms *parms)
                 if (parms->type == AP_EXPR_FUNC_OP_UNARY)
                     match = !strcmp(prov->name, parms->name);
                 else
-                    match = !strcasecmp(prov->name, parms->name);
+                    match = !ap_casecmpstr(prov->name, parms->name);
                 if (match) {
                     if ((parms->flags & AP_EXPR_FLAG_RESTRICTED)
                         && prov->restricted) {
index 943957d1c9631505ee7cb21ca8738caf13768c41..651b11909477966e168a05cdc0ea259db5f0e5c0 100644 (file)
@@ -180,10 +180,10 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
          * for no particular reason.
          */
 
-        if (!strcasecmp(hdrs[i].key, "Content-type")) {
+        if (!ap_casecmpstr(hdrs[i].key, "Content-type")) {
             apr_table_addn(e, "CONTENT_TYPE", hdrs[i].val);
         }
-        else if (!strcasecmp(hdrs[i].key, "Content-length")) {
+        else if (!ap_casecmpstr(hdrs[i].key, "Content-length")) {
             apr_table_addn(e, "CONTENT_LENGTH", hdrs[i].val);
         }
         /*
@@ -192,8 +192,8 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
          * in the environment with "ps -e".  But, if you must...
          */
 #ifndef SECURITY_HOLE_PASS_AUTHORIZATION
-        else if (!strcasecmp(hdrs[i].key, "Authorization")
-                 || !strcasecmp(hdrs[i].key, "Proxy-Authorization")) {
+        else if (!ap_casecmpstr(hdrs[i].key, "Authorization")
+                 || !ap_casecmpstr(hdrs[i].key, "Proxy-Authorization")) {
             if (conf->cgi_pass_auth == AP_CGI_PASS_AUTH_ON) {
                 add_unless_null(e, http2env(r, hdrs[i].key), hdrs[i].val);
             }
@@ -597,7 +597,7 @@ AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
             ++l;
         }
 
-        if (!strcasecmp(w, "Content-type")) {
+        if (!ap_casecmpstr(w, "Content-type")) {
             char *tmp;
 
             /* Nuke trailing whitespace */
@@ -615,7 +615,7 @@ AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
          * If the script returned a specific status, that's what
          * we'll use - otherwise we assume 200 OK.
          */
-        else if (!strcasecmp(w, "Status")) {
+        else if (!ap_casecmpstr(w, "Status")) {
             r->status = cgi_status = atoi(l);
             if (!ap_is_HTTP_VALID_RESPONSE(cgi_status))
                 ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
@@ -628,30 +628,30 @@ AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
                                  apr_filepath_name_get(r->filename), l);
             r->status_line = apr_pstrdup(r->pool, l);
         }
-        else if (!strcasecmp(w, "Location")) {
+        else if (!ap_casecmpstr(w, "Location")) {
             apr_table_set(r->headers_out, w, l);
         }
-        else if (!strcasecmp(w, "Content-Length")) {
+        else if (!ap_casecmpstr(w, "Content-Length")) {
             apr_table_set(r->headers_out, w, l);
         }
-        else if (!strcasecmp(w, "Content-Range")) {
+        else if (!ap_casecmpstr(w, "Content-Range")) {
             apr_table_set(r->headers_out, w, l);
         }
-        else if (!strcasecmp(w, "Transfer-Encoding")) {
+        else if (!ap_casecmpstr(w, "Transfer-Encoding")) {
             apr_table_set(r->headers_out, w, l);
         }
-        else if (!strcasecmp(w, "ETag")) {
+        else if (!ap_casecmpstr(w, "ETag")) {
             apr_table_set(r->headers_out, w, l);
         }
         /*
          * If the script gave us a Last-Modified header, we can't just
          * pass it on blindly because of restrictions on future values.
          */
-        else if (!strcasecmp(w, "Last-Modified")) {
+        else if (!ap_casecmpstr(w, "Last-Modified")) {
             ap_update_mtime(r, apr_date_parse_http(l));
             ap_set_last_modified(r);
         }
-        else if (!strcasecmp(w, "Set-Cookie")) {
+        else if (!ap_casecmpstr(w, "Set-Cookie")) {
             apr_table_add(cookie_table, w, l);
         }
         else {