1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Revert r1715789: will re-commit without spurious functional changes.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1715869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yann Ylavic
2015-11-23 16:28:36 +00:00
parent 15d829531e
commit 3c9ddf44bf
33 changed files with 290 additions and 242 deletions

View File

@@ -594,12 +594,7 @@ int cache_check_freshness(cache_handle_t *h, cache_request_rec *cache,
} }
if ((agestr = apr_table_get(h->resp_hdrs, "Age"))) { if ((agestr = apr_table_get(h->resp_hdrs, "Age"))) {
char *endp; age_c = apr_atoi64(agestr);
apr_off_t offt;
if (!apr_strtoff(&offt, agestr, &endp, 10)
&& endp > agestr && !*endp) {
age_c = offt;
}
} }
/* calculate age of object */ /* calculate age of object */
@@ -999,7 +994,12 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
char *header = apr_pstrdup(r->pool, pragma_header); char *header = apr_pstrdup(r->pool, pragma_header);
const char *token = cache_strqtok(header, CACHE_SEPARATOR, &last); const char *token = cache_strqtok(header, CACHE_SEPARATOR, &last);
while (token) { while (token) {
if (!ap_casecmpstr(token, "no-cache")) { /* handle most common quickest case... */
if (!strcmp(token, "no-cache")) {
cc->no_cache = 1;
}
/* ...then try slowest case */
else if (!strcasecmp(token, "no-cache")) {
cc->no_cache = 1; cc->no_cache = 1;
} }
token = cache_strqtok(NULL, CACHE_SEPARATOR, &last); token = cache_strqtok(NULL, CACHE_SEPARATOR, &last);
@@ -1008,15 +1008,21 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
} }
if (cc_header) { if (cc_header) {
char *endp;
apr_off_t offt;
char *header = apr_pstrdup(r->pool, cc_header); char *header = apr_pstrdup(r->pool, cc_header);
const char *token = cache_strqtok(header, CACHE_SEPARATOR, &last); const char *token = cache_strqtok(header, CACHE_SEPARATOR, &last);
while (token) { while (token) {
switch (token[0]) { switch (token[0]) {
case 'n': case 'n':
case 'N': { case 'N': {
if (!ap_casecmpstrn(token, "no-cache", 8)) { /* 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 (token[8] == '=') { if (token[8] == '=') {
cc->no_cache_header = 1; cc->no_cache_header = 1;
} }
@@ -1025,63 +1031,73 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
} }
break; break;
} }
else if (!ap_casecmpstr(token, "no-store")) { else if (!strcasecmp(token, "no-store")) {
cc->no_store = 1; cc->no_store = 1;
} }
else if (!ap_casecmpstr(token, "no-transform")) { else if (!strcasecmp(token, "no-transform")) {
cc->no_transform = 1; cc->no_transform = 1;
} }
break; break;
} }
case 'm': case 'm':
case 'M': { case 'M': {
if (!ap_casecmpstrn(token, "max-age", 7)) { /* handle most common quickest cases... */
if (token[7] == '=' if (!strcmp(token, "max-age=0")) {
&& !apr_strtoff(&offt, token + 8, &endp, 10)
&& endp > token + 8 && !*endp) {
cc->max_age = 1; cc->max_age = 1;
cc->max_age_value = offt; cc->max_age_value = 0;
} }
} else if (!strcmp(token, "must-revalidate")) {
else if (!ap_casecmpstr(token, "must-revalidate")) {
cc->must_revalidate = 1; cc->must_revalidate = 1;
} }
else if (!ap_casecmpstrn(token, "max-stale", 9)) { /* ...then try slowest cases */
if (token[9] == '=' else if (!strncasecmp(token, "max-age", 7)) {
&& !apr_strtoff(&offt, token + 10, &endp, 10) if (token[7] == '=') {
&& endp > token + 10 && !*endp) { cc->max_age = 1;
cc->max_stale = 1; cc->max_age_value = apr_atoi64(token + 8);
cc->max_stale_value = offt;
} }
else if (!token[9]) { break;
}
else if (!strncasecmp(token, "max-stale", 9)) {
if (token[9] == '=') {
cc->max_stale = 1;
cc->max_stale_value = apr_atoi64(token + 10);
}
else if (!token[10]) {
cc->max_stale = 1; cc->max_stale = 1;
cc->max_stale_value = -1; cc->max_stale_value = -1;
} }
break; break;
} }
else if (!ap_casecmpstrn(token, "min-fresh", 9)) { else if (!strncasecmp(token, "min-fresh", 9)) {
if (token[9] == '=' if (token[9] == '=') {
&& !apr_strtoff(&offt, token + 10, &endp, 10)
&& endp > token + 10 && !*endp) {
cc->min_fresh = 1; cc->min_fresh = 1;
cc->min_fresh_value = offt; cc->min_fresh_value = apr_atoi64(token + 10);
} }
break; break;
} }
else if (!strcasecmp(token, "must-revalidate")) {
cc->must_revalidate = 1;
}
break; break;
} }
case 'o': case 'o':
case 'O': { case 'O': {
if (!ap_casecmpstr(token, "only-if-cached")) { if (!strcasecmp(token, "only-if-cached")) {
cc->only_if_cached = 1; cc->only_if_cached = 1;
} }
break; break;
} }
case 'p': { case 'p':
if (!ap_casecmpstr(token, "public")) { case 'P': {
/* handle most common quickest cases... */
if (!strcmp(token, "private")) {
cc->private = 1;
}
/* ...then try slowest cases */
else if (!strcasecmp(token, "public")) {
cc->public = 1; cc->public = 1;
} }
else if (!ap_casecmpstrn(token, "private", 7)) { else if (!strncasecmp(token, "private", 7)) {
if (token[7] == '=') { if (token[7] == '=') {
cc->private_header = 1; cc->private_header = 1;
} }
@@ -1090,20 +1106,19 @@ int ap_cache_control(request_rec *r, cache_control_t *cc,
} }
break; break;
} }
else if (!ap_casecmpstr(token, "proxy-revalidate")) { else if (!strcasecmp(token, "proxy-revalidate")) {
cc->proxy_revalidate = 1; cc->proxy_revalidate = 1;
} }
break; break;
} }
case 's': case 's':
case 'S': { case 'S': {
if (!ap_casecmpstrn(token, "s-maxage", 8)) { if (!strncasecmp(token, "s-maxage", 8)) {
if (token[8] == '=' if (token[8] == '=') {
&& !apr_strtoff(&offt, token + 9, &endp, 10)
&& endp > token + 9 && !*endp) {
cc->s_maxage = 1; cc->s_maxage = 1;
cc->s_maxage_value = offt; cc->s_maxage_value = apr_atoi64(token + 9);
} }
break;
} }
break; break;
} }
@@ -1133,7 +1148,8 @@ static int cache_control_remove(request_rec *r, const char *cc_header,
switch (token[0]) { switch (token[0]) {
case 'n': case 'n':
case 'N': { case 'N': {
if (!ap_casecmpstrn(token, "no-cache", 8)) { if (!strncmp(token, "no-cache", 8)
|| !strncasecmp(token, "no-cache", 8)) {
if (token[8] == '=') { if (token[8] == '=') {
const char *header = cache_strqtok(token + 9, const char *header = cache_strqtok(token + 9,
CACHE_SEPARATOR "\"", &slast); CACHE_SEPARATOR "\"", &slast);
@@ -1150,7 +1166,8 @@ static int cache_control_remove(request_rec *r, const char *cc_header,
} }
case 'p': case 'p':
case 'P': { case 'P': {
if (!ap_casecmpstrn(token, "private", 7)) { if (!strncmp(token, "private", 7)
|| !strncasecmp(token, "private", 7)) {
if (token[7] == '=') { if (token[7] == '=') {
const char *header = cache_strqtok(token + 8, const char *header = cache_strqtok(token + 8,
CACHE_SEPARATOR "\"", &slast); CACHE_SEPARATOR "\"", &slast);

View File

@@ -123,8 +123,8 @@ static int check_gzip(request_rec *r, apr_table_t *hdrs1, apr_table_t *hdrs2)
if (encoding && *encoding) { if (encoding && *encoding) {
/* check the usual/simple case first */ /* check the usual/simple case first */
if (!ap_casecmpstr(encoding, "gzip") if (!strcasecmp(encoding, "gzip")
|| !ap_casecmpstr(encoding, "x-gzip")) { || !strcasecmp(encoding, "x-gzip")) {
found = 1; found = 1;
if (hdrs) { if (hdrs) {
apr_table_unset(hdrs, "Content-Encoding"); 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(;;) { for(;;) {
char *token = ap_strrchr(new_encoding, ','); char *token = ap_strrchr(new_encoding, ',');
if (!token) { /* gzip:identity or other:identity */ if (!token) { /* gzip:identity or other:identity */
if (!ap_casecmpstr(new_encoding, "gzip") if (!strcasecmp(new_encoding, "gzip")
|| !ap_casecmpstr(new_encoding, "x-gzip")) { || !strcasecmp(new_encoding, "x-gzip")) {
found = 1; found = 1;
if (hdrs) { if (hdrs) {
apr_table_unset(hdrs, "Content-Encoding"); 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 */ break; /* seen all tokens */
} }
for (ptr=token+1; apr_isspace(*ptr); ++ptr); for (ptr=token+1; apr_isspace(*ptr); ++ptr);
if (!ap_casecmpstr(ptr, "gzip") if (!strcasecmp(ptr, "gzip")
|| !ap_casecmpstr(ptr, "x-gzip")) { || !strcasecmp(ptr, "x-gzip")) {
*token = '\0'; *token = '\0';
if (hdrs) { if (hdrs) {
apr_table_setn(hdrs, "Content-Encoding", new_encoding); 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; found = 1;
} }
else if (!ptr[0] || !ap_casecmpstr(ptr, "identity")) { else if (!ptr[0] || !strcasecmp(ptr, "identity")) {
*token = '\0'; *token = '\0';
continue; /* strip the token and find the next one */ 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); token = ap_get_token(r->pool, &accepts, 0);
while (token && token[0] && ap_casecmpstr(token, "gzip")) { while (token && token[0] && strcasecmp(token, "gzip")) {
/* skip parameters, XXX: ;q=foo evaluation? */ /* skip parameters, XXX: ;q=foo evaluation? */
while (*accepts == ';') { while (*accepts == ';') {
++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 the entire Content-Encoding is "identity", we can replace it. */
if (!encoding || !ap_casecmpstr(encoding, "identity")) { if (!encoding || !strcasecmp(encoding, "identity")) {
apr_table_setn(r->headers_out, "Content-Encoding", "gzip"); apr_table_setn(r->headers_out, "Content-Encoding", "gzip");
} }
else { else {

View 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) static const char *add_include_vars_lazy(request_rec *r, const char *var, const char *timefmt)
{ {
char *val; char *val;
if (!ap_casecmpstr(var, "DATE_LOCAL")) { if (!strcasecmp(var, "DATE_LOCAL")) {
val = ap_ht_time(r->pool, r->request_time, timefmt, 0); val = ap_ht_time(r->pool, r->request_time, timefmt, 0);
} }
else if (!ap_casecmpstr(var, "DATE_GMT")) { else if (!strcasecmp(var, "DATE_GMT")) {
val = ap_ht_time(r->pool, r->request_time, timefmt, 1); val = ap_ht_time(r->pool, r->request_time, timefmt, 1);
} }
else if (!ap_casecmpstr(var, "LAST_MODIFIED")) { else if (!strcasecmp(var, "LAST_MODIFIED")) {
val = ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0); val = ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0);
} }
else if (!ap_casecmpstr(var, "USER_NAME")) { else if (!strcasecmp(var, "USER_NAME")) {
if (apr_uid_name_get(&val, r->finfo.user, r->pool) != APR_SUCCESS) { if (apr_uid_name_get(&val, r->finfo.user, r->pool) != APR_SUCCESS) {
val = "<unknown>"; val = "<unknown>";
} }
@@ -714,9 +714,9 @@ static int include_expr_lookup(ap_expr_lookup_parms *parms)
{ {
switch (parms->type) { switch (parms->type) {
case AP_EXPR_FUNC_STRING: case AP_EXPR_FUNC_STRING:
if (ap_casecmpstr(parms->name, "v") == 0 || if (strcasecmp(parms->name, "v") == 0 ||
ap_casecmpstr(parms->name, "reqenv") == 0 || strcasecmp(parms->name, "reqenv") == 0 ||
ap_casecmpstr(parms->name, "env") == 0) { strcasecmp(parms->name, "env") == 0) {
*parms->func = include_expr_var_fn; *parms->func = include_expr_var_fn;
*parms->data = parms->name; *parms->data = parms->name;
return OK; 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); token = apr_strtok(d, ", \t", &last);
while (token) { while (token) {
if (!ap_casecmpstr(token, "none")) { if (!strcasecmp(token, "none")) {
/* do nothing */ /* do nothing */
} }
else if (!ap_casecmpstr(token, "url")) { else if (!strcasecmp(token, "url")) {
char *buf = apr_pstrdup(ctx->pool, echo_text); char *buf = apr_pstrdup(ctx->pool, echo_text);
ap_unescape_url(buf); ap_unescape_url(buf);
echo_text = buf; echo_text = buf;
} }
else if (!ap_casecmpstr(token, "urlencoded")) { else if (!strcasecmp(token, "urlencoded")) {
char *buf = apr_pstrdup(ctx->pool, echo_text); char *buf = apr_pstrdup(ctx->pool, echo_text);
ap_unescape_urlencoded(buf); ap_unescape_urlencoded(buf);
echo_text = buf; echo_text = buf;
} }
else if (!ap_casecmpstr(token, "entity")) { else if (!strcasecmp(token, "entity")) {
char *buf = apr_pstrdup(ctx->pool, echo_text); char *buf = apr_pstrdup(ctx->pool, echo_text);
decodehtml(buf); decodehtml(buf);
echo_text = buf; echo_text = buf;
} }
else if (!ap_casecmpstr(token, "base64")) { else if (!strcasecmp(token, "base64")) {
echo_text = ap_pbase64decode(ctx->dpool, echo_text); echo_text = ap_pbase64decode(ctx->dpool, echo_text);
} }
else { 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); token = apr_strtok(e, ", \t", &last);
while (token) { while (token) {
if (!ap_casecmpstr(token, "none")) { if (!strcasecmp(token, "none")) {
/* do nothing */ /* do nothing */
} }
else if (!ap_casecmpstr(token, "url")) { else if (!strcasecmp(token, "url")) {
echo_text = ap_escape_uri(ctx->dpool, echo_text); echo_text = ap_escape_uri(ctx->dpool, echo_text);
} }
else if (!ap_casecmpstr(token, "urlencoded")) { else if (!strcasecmp(token, "urlencoded")) {
echo_text = ap_escape_urlencoded(ctx->dpool, echo_text); echo_text = ap_escape_urlencoded(ctx->dpool, echo_text);
} }
else if (!ap_casecmpstr(token, "entity")) { else if (!strcasecmp(token, "entity")) {
echo_text = ap_escape_html2(ctx->dpool, echo_text, 0); echo_text = ap_escape_html2(ctx->dpool, echo_text, 0);
} }
else if (!ap_casecmpstr(token, "base64")) { else if (!strcasecmp(token, "base64")) {
char *buf; char *buf;
buf = ap_pbase64encode(ctx->dpool, (char *)echo_text); buf = ap_pbase64encode(ctx->dpool, (char *)echo_text);
echo_text = buf; 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); token = apr_strtok(d, ", \t", &last);
while (token) { while (token) {
if (!ap_casecmpstr(token, "none")) { if (!strcasecmp(token, "none")) {
/* do nothing */ /* do nothing */
} }
else if (!ap_casecmpstr(token, "url")) { else if (!strcasecmp(token, "url")) {
char *buf = apr_pstrdup(ctx->pool, parsed_string); char *buf = apr_pstrdup(ctx->pool, parsed_string);
ap_unescape_url(buf); ap_unescape_url(buf);
parsed_string = buf; parsed_string = buf;
} }
else if (!ap_casecmpstr(token, "urlencoded")) { else if (!strcasecmp(token, "urlencoded")) {
char *buf = apr_pstrdup(ctx->pool, parsed_string); char *buf = apr_pstrdup(ctx->pool, parsed_string);
ap_unescape_urlencoded(buf); ap_unescape_urlencoded(buf);
parsed_string = buf; parsed_string = buf;
} }
else if (!ap_casecmpstr(token, "entity")) { else if (!strcasecmp(token, "entity")) {
char *buf = apr_pstrdup(ctx->pool, parsed_string); char *buf = apr_pstrdup(ctx->pool, parsed_string);
decodehtml(buf); decodehtml(buf);
parsed_string = buf; parsed_string = buf;
} }
else if (!ap_casecmpstr(token, "base64")) { else if (!strcasecmp(token, "base64")) {
parsed_string = ap_pbase64decode(ctx->dpool, parsed_string); parsed_string = ap_pbase64decode(ctx->dpool, parsed_string);
} }
else { 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); token = apr_strtok(e, ", \t", &last);
while (token) { while (token) {
if (!ap_casecmpstr(token, "none")) { if (!strcasecmp(token, "none")) {
/* do nothing */ /* do nothing */
} }
else if (!ap_casecmpstr(token, "url")) { else if (!strcasecmp(token, "url")) {
parsed_string = ap_escape_uri(ctx->dpool, parsed_string); parsed_string = ap_escape_uri(ctx->dpool, parsed_string);
} }
else if (!ap_casecmpstr(token, "urlencoded")) { else if (!strcasecmp(token, "urlencoded")) {
parsed_string = ap_escape_urlencoded(ctx->dpool, parsed_string); parsed_string = ap_escape_urlencoded(ctx->dpool, parsed_string);
} }
else if (!ap_casecmpstr(token, "entity")) { else if (!strcasecmp(token, "entity")) {
parsed_string = ap_escape_html2(ctx->dpool, parsed_string, 0); parsed_string = ap_escape_html2(ctx->dpool, parsed_string, 0);
} }
else if (!ap_casecmpstr(token, "base64")) { else if (!strcasecmp(token, "base64")) {
char *buf; char *buf;
buf = ap_pbase64encode(ctx->dpool, (char *)parsed_string); buf = ap_pbase64encode(ctx->dpool, (char *)parsed_string);
parsed_string = buf; parsed_string = buf;

View 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); ap_fputstrs(ctx->f->next, ctx->bb, "<!DOCTYPE ", (const char *)name, NULL);
if (externalID) { if (externalID) {
if (!ap_casecmpstr((const char*)name, "html") && if (!strcasecmp((const char*)name, "html") &&
!ap_casecmpstrn((const char *)externalID, "-//W3C//DTD XHTML ", 18)) { !strncasecmp((const char *)externalID, "-//W3C//DTD XHTML ", 18)) {
ctx->etag = xhtml_etag; ctx->etag = xhtml_etag;
} }
else { else {
@@ -690,7 +690,7 @@ static meta *metafix(request_rec *r, const char *buf)
while (!apr_isalpha(*++p)); while (!apr_isalpha(*++p));
for (q = p; apr_isalnum(*q) || (*q == '-'); ++q); for (q = p; apr_isalnum(*q) || (*q == '-'); ++q);
header = apr_pstrndup(r->pool, p, q-p); header = apr_pstrndup(r->pool, p, q-p);
if (ap_casecmpstrn(header, "Content-", 8)) { if (strncasecmp(header, "Content-", 8)) {
/* find content=... string */ /* find content=... string */
p = apr_strmatch(seek_content, buf+offs+pmatch[0].rm_so, p = apr_strmatch(seek_content, buf+offs+pmatch[0].rm_so,
pmatch[0].rm_eo - 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 (!ap_casecmpstrn(header, "Content-Type", 12)) { else if (!strncasecmp(header, "Content-Type", 12)) {
ret = apr_palloc(r->pool, sizeof(meta)); ret = apr_palloc(r->pool, sizeof(meta));
ret->start = offs+pmatch[0].rm_so; ret->start = offs+pmatch[0].rm_so;
ret->end = offs+pmatch[0].rm_eo; 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) { else if (!f->r->content_type) {
errmsg = "No content-type; bailing out of proxy-html filter"; errmsg = "No content-type; bailing out of proxy-html filter";
} }
else if (ap_casecmpstrn(f->r->content_type, "text/html", 9) && else if (strncasecmp(f->r->content_type, "text/html", 9) &&
ap_casecmpstrn(f->r->content_type, strncasecmp(f->r->content_type,
"application/xhtml+xml", 21)) { "application/xhtml+xml", 21)) {
errmsg = "Non-HTML content; not inserting proxy-html filter"; errmsg = "Non-HTML content; not inserting proxy-html filter";
} }

View File

@@ -1068,7 +1068,7 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
emit_H1 = 1; emit_H1 = 1;
} }
} }
else if (!ap_casecmpstrn("text/", rr->content_type, 5)) { else if (!strncasecmp("text/", rr->content_type, 5)) {
/* /*
* If we can open the file, prefix it with the preamble * If we can open the file, prefix it with the preamble
* regardless; since we'll be sending a <pre> block around * 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; suppress_post = suppress_amble;
} }
} }
else if (!ap_casecmpstrn("text/", rr->content_type, 5)) { else if (!strncasecmp("text/", rr->content_type, 5)) {
/* /*
* If we can open the file, suppress the signature. * If we can open the file, suppress the signature.
*/ */

View File

@@ -78,7 +78,7 @@ static void discard_script_output(apr_bucket_brigade *bb);
static int is_scriptaliased(request_rec *r) static int is_scriptaliased(request_rec *r)
{ {
const char *t = apr_table_get(r->notes, "alias-forced-type"); const char *t = apr_table_get(r->notes, "alias-forced-type");
return t && (!ap_casecmpstr(t, "cgi-script")); return t && (!strcasecmp(t, "cgi-script"));
} }
/* Configuration stuff */ /* Configuration stuff */

View 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) static int is_scriptaliased(request_rec *r)
{ {
const char *t = apr_table_get(r->notes, "alias-forced-type"); const char *t = apr_table_get(r->notes, "alias-forced-type");
return t && (!ap_casecmpstr(t, "cgi-script")); return t && (!strcasecmp(t, "cgi-script"));
} }
/* Configuration stuff */ /* Configuration stuff */

View 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"); range = apr_table_get(r->headers_in, "Range");
if (!range || ap_casecmpstrn(range, "bytes=", 6) || r->status != HTTP_OK) { if (!range || strncasecmp(range, "bytes=", 6) || r->status != HTTP_OK) {
return 0; return 0;
} }
@@ -112,7 +112,7 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
/* is content already a multiple range? */ /* is content already a multiple range? */
if ((ct = apr_table_get(r->headers_out, "Content-Type")) if ((ct = apr_table_get(r->headers_out, "Content-Type"))
&& ap_casecmpstrn(ct, "multipart/byteranges", 20) == 0) { && strncasecmp(ct, "multipart/byteranges", 20) == 0) {
return 0; return 0;
} }

View 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"); lenp = apr_table_get(f->r->headers_in, "Content-Length");
if (tenc) { if (tenc) {
if (ap_casecmpstr(tenc, "chunked") == 0 /* fast path */ if (strcasecmp(tenc, "chunked") == 0 /* fast path */
|| ap_find_last_token(f->r->pool, tenc, "chunked")) { || ap_find_last_token(f->r->pool, tenc, "chunked")) {
ctx->state = BODY_CHUNK; 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; for (i = 0, strpp = (char **) values->elts; i < values->nelts;
++i, ++strpp) { ++i, ++strpp) {
if (*strpp && ap_casecmpstr(*strpp, start) == 0) { if (*strpp && strcasecmp(*strpp, start) == 0) {
break; break;
} }
} }
@@ -1543,7 +1543,7 @@ AP_DECLARE(int) ap_setup_client_block(request_rec *r, int read_policy)
r->remaining = 0; r->remaining = 0;
if (tenc) { if (tenc) {
if (ap_casecmpstr(tenc, "chunked")) { if (strcasecmp(tenc, "chunked")) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01592) ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(01592)
"Unknown Transfer-Encoding %s", tenc); "Unknown Transfer-Encoding %s", tenc);
return HTTP_NOT_IMPLEMENTED; return HTTP_NOT_IMPLEMENTED;

View 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; for (i = 0, strpp = (char **) values->elts; i < values->nelts;
++i, ++strpp) { ++i, ++strpp) {
if (*strpp && ap_casecmpstr(*strpp, start) == 0) { if (*strpp && strcasecmp(*strpp, start) == 0) {
break; break;
} }
} }

View File

@@ -497,7 +497,7 @@ static APR_INLINE char *find_multiple_headers(apr_pool_t *pool,
result_list = rp = NULL; result_list = rp = NULL;
do { do {
if (!ap_casecmpstr(t_elt->key, key)) { if (!strcasecmp(t_elt->key, key)) {
if (!result_list) { if (!result_list) {
result_list = rp = apr_palloc(pool, sizeof(*rp)); 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; const char *cp = NULL;
if (!ap_casecmpstr(a, "Content-type") && r->content_type) { if (!strcasecmp(a, "Content-type") && r->content_type) {
cp = ap_field_noparam(r->pool, r->content_type); cp = ap_field_noparam(r->pool, r->content_type);
} }
else if (!ap_casecmpstr(a, "Set-Cookie")) { else if (!strcasecmp(a, "Set-Cookie")) {
cp = find_multiple_headers(r->pool, r->headers_out, a); cp = find_multiple_headers(r->pool, r->headers_out, a);
} }
else { 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) static const char *log_request_duration_scaled(request_rec *r, char *a)
{ {
apr_time_t duration = get_request_end_time(r) - r->request_time; apr_time_t duration = get_request_end_time(r) - r->request_time;
if (*a == '\0' || !ap_casecmpstr(a, "s")) { if (*a == '\0' || !strcasecmp(a, "s")) {
duration = apr_time_sec(duration); duration = apr_time_sec(duration);
} }
else if (!ap_casecmpstr(a, "ms")) { else if (!strcasecmp(a, "ms")) {
duration = apr_time_as_msec(duration); duration = apr_time_as_msec(duration);
} }
else if (!ap_casecmpstr(a, "us")) { else if (!strcasecmp(a, "us")) {
} }
else { else {
/* bogus format */ /* bogus format */
@@ -835,13 +835,13 @@ static const char *log_server_port(request_rec *r, char *a)
{ {
apr_port_t port; apr_port_t port;
if (*a == '\0' || !ap_casecmpstr(a, "canonical")) { if (*a == '\0' || !strcasecmp(a, "canonical")) {
port = r->server->port ? r->server->port : ap_default_port(r); port = r->server->port ? r->server->port : ap_default_port(r);
} }
else if (!ap_casecmpstr(a, "remote")) { else if (!strcasecmp(a, "remote")) {
port = r->useragent_addr->port; port = r->useragent_addr->port;
} }
else if (!ap_casecmpstr(a, "local")) { else if (!strcasecmp(a, "local")) {
port = r->connection->local_addr->port; port = r->connection->local_addr->port;
} }
else { 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) static const char *log_pid_tid(request_rec *r, char *a)
{ {
if (*a == '\0' || !ap_casecmpstr(a, "pid")) { if (*a == '\0' || !strcasecmp(a, "pid")) {
return ap_append_pid(r->pool, "", ""); return ap_append_pid(r->pool, "", "");
} }
else if (!ap_casecmpstr(a, "tid") || !ap_casecmpstr(a, "hextid")) { else if (!strcasecmp(a, "tid") || !strcasecmp(a, "hextid")) {
#if APR_HAS_THREADS #if APR_HAS_THREADS
apr_os_thread_t tid = apr_os_thread_current(); apr_os_thread_t tid = apr_os_thread_current();
#else #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_var = NULL;
cls->condition_expr = NULL; cls->condition_expr = NULL;
if (envclause != NULL) { if (envclause != NULL) {
if (ap_casecmpstrn(envclause, "env=", 4) == 0) { if (strncasecmp(envclause, "env=", 4) == 0) {
if ((envclause[4] == '\0') if ((envclause[4] == '\0')
|| ((envclause[4] == '!') && (envclause[5] == '\0'))) { || ((envclause[4] == '!') && (envclause[5] == '\0'))) {
return "missing environment variable name"; return "missing environment variable name";
} }
cls->condition_var = apr_pstrdup(cmd->pool, &envclause[4]); cls->condition_var = apr_pstrdup(cmd->pool, &envclause[4]);
} }
else if (ap_casecmpstrn(envclause, "expr=", 5) == 0) { else if (strncasecmp(envclause, "expr=", 5) == 0) {
const char *err; const char *err;
if ((envclause[5] == '\0')) if ((envclause[5] == '\0'))
return "missing condition"; return "missing condition";

View File

@@ -525,7 +525,7 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
switch (*uri++) { switch (*uri++) {
case 'a': case 'a':
case 'A': case 'A':
if (!ap_casecmpstrn(uri, "jp://", 5)) { /* ajp:// */ if (!strncasecmp(uri, "jp://", 5)) { /* ajp:// */
*sqs = 1; *sqs = 1;
return 6; return 6;
} }
@@ -533,7 +533,7 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
case 'b': case 'b':
case 'B': case 'B':
if (!ap_casecmpstrn(uri, "alancer://", 10)) { /* balancer:// */ if (!strncasecmp(uri, "alancer://", 10)) { /* balancer:// */
*sqs = 1; *sqs = 1;
return 11; return 11;
} }
@@ -541,10 +541,10 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
case 'f': case 'f':
case 'F': case 'F':
if (!ap_casecmpstrn(uri, "tp://", 5)) { /* ftp:// */ if (!strncasecmp(uri, "tp://", 5)) { /* ftp:// */
return 6; return 6;
} }
if (!ap_casecmpstrn(uri, "cgi://", 6)) { /* fcgi:// */ if (!strncasecmp(uri, "cgi://", 6)) { /* fcgi:// */
*sqs = 1; *sqs = 1;
return 7; return 7;
} }
@@ -552,18 +552,18 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
case 'g': case 'g':
case 'G': case 'G':
if (!ap_casecmpstrn(uri, "opher://", 8)) { /* gopher:// */ if (!strncasecmp(uri, "opher://", 8)) { /* gopher:// */
return 9; return 9;
} }
break; break;
case 'h': case 'h':
case 'H': case 'H':
if (!ap_casecmpstrn(uri, "ttp://", 6)) { /* http:// */ if (!strncasecmp(uri, "ttp://", 6)) { /* http:// */
*sqs = 1; *sqs = 1;
return 7; return 7;
} }
else if (!ap_casecmpstrn(uri, "ttps://", 7)) { /* https:// */ else if (!strncasecmp(uri, "ttps://", 7)) { /* https:// */
*sqs = 1; *sqs = 1;
return 8; return 8;
} }
@@ -571,14 +571,14 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
case 'l': case 'l':
case 'L': case 'L':
if (!ap_casecmpstrn(uri, "dap://", 6)) { /* ldap:// */ if (!strncasecmp(uri, "dap://", 6)) { /* ldap:// */
return 7; return 7;
} }
break; break;
case 'm': case 'm':
case 'M': case 'M':
if (!ap_casecmpstrn(uri, "ailto:", 6)) { /* mailto: */ if (!strncasecmp(uri, "ailto:", 6)) { /* mailto: */
*sqs = 1; *sqs = 1;
return 7; return 7;
} }
@@ -586,17 +586,17 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
case 'n': case 'n':
case 'N': case 'N':
if (!ap_casecmpstrn(uri, "ews:", 4)) { /* news: */ if (!strncasecmp(uri, "ews:", 4)) { /* news: */
return 5; return 5;
} }
else if (!ap_casecmpstrn(uri, "ntp://", 6)) { /* nntp:// */ else if (!strncasecmp(uri, "ntp://", 6)) { /* nntp:// */
return 7; return 7;
} }
break; break;
case 's': case 's':
case 'S': case 'S':
if (!ap_casecmpstrn(uri, "cgi://", 6)) { /* scgi:// */ if (!strncasecmp(uri, "cgi://", 6)) { /* scgi:// */
*sqs = 1; *sqs = 1;
return 7; return 7;
} }
@@ -604,11 +604,11 @@ static unsigned is_absolute_uri(char *uri, int *supportsqs)
case 'w': case 'w':
case 'W': case 'W':
if (!ap_casecmpstrn(uri, "s://", 4)) { /* ws:// */ if (!strncasecmp(uri, "s://", 4)) { /* ws:// */
*sqs = 1; *sqs = 1;
return 5; return 5;
} }
else if (!ap_casecmpstrn(uri, "ss://", 5)) { /* wss:// */ else if (!strncasecmp(uri, "ss://", 5)) { /* wss:// */
*sqs = 1; *sqs = 1;
return 6; return 6;
} }
@@ -716,7 +716,7 @@ static char *escape_absolute_uri(apr_pool_t *p, char *uri, unsigned scheme)
* [dn ["?" [attributes] ["?" [scope] * [dn ["?" [attributes] ["?" [scope]
* ["?" [filter] ["?" extensions]]]]]] * ["?" [filter] ["?" extensions]]]]]]
*/ */
if (!ap_casecmpstrn(uri, "ldap", 4)) { if (!strncasecmp(uri, "ldap", 4)) {
char *token[5]; char *token[5];
int c = 0; int c = 0;
@@ -1576,7 +1576,7 @@ static char *lookup_map_program(request_rec *r, apr_file_t *fpin,
} }
/* catch the "failed" case */ /* catch the "failed" case */
if (i == 4 && !ap_casecmpstr(buf, "NULL")) { if (i == 4 && !strcasecmp(buf, "NULL")) {
return NULL; return NULL;
} }
@@ -1829,7 +1829,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
/* fast tests for variable length variables (sic) first */ /* fast tests for variable length variables (sic) first */
if (var[3] == ':') { if (var[3] == ':') {
if (var[4] && !ap_casecmpstrn(var, "ENV", 3)) { if (var[4] && !strncasecmp(var, "ENV", 3)) {
var += 4; var += 4;
result = apr_table_get(r->notes, var); result = apr_table_get(r->notes, var);
@@ -1840,7 +1840,7 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
result = getenv(var); result = getenv(var);
} }
} }
else if (var[4] && !ap_casecmpstrn(var, "SSL", 3) && rewrite_ssl_lookup) { else if (var[4] && !strncasecmp(var, "SSL", 3) && rewrite_ssl_lookup) {
result = rewrite_ssl_lookup(r->pool, r->server, r->connection, r, result = rewrite_ssl_lookup(r->pool, r->server, r->connection, r,
var + 4); var + 4);
} }
@@ -1850,10 +1850,10 @@ static char *lookup_variable(char *var, rewrite_ctx *ctx)
request_rec *rr; request_rec *rr;
const char *path; const char *path;
if (!ap_casecmpstrn(var, "HTTP", 4)) { if (!strncasecmp(var, "HTTP", 4)) {
result = lookup_header(var+5, ctx); result = lookup_header(var+5, ctx);
} }
else if (!ap_casecmpstrn(var, "LA-U", 4)) { else if (!strncasecmp(var, "LA-U", 4)) {
if (ctx->uri && subreq_ok(r)) { if (ctx->uri && subreq_ok(r)) {
path = ctx->perdir ? la_u(ctx) : ctx->uri; path = ctx->perdir ? la_u(ctx) : ctx->uri;
rr = ap_sub_req_lookup_uri(path, r, NULL); 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; return (char *)result;
} }
} }
else if (!ap_casecmpstrn(var, "LA-F", 4)) { else if (!strncasecmp(var, "LA-F", 4)) {
if (ctx->uri && subreq_ok(r)) { if (ctx->uri && subreq_ok(r)) {
path = ctx->uri; path = ctx->uri;
if (ctx->perdir && *path == '/') { if (ctx->perdir && *path == '/') {
@@ -2575,14 +2575,14 @@ static void add_cookie(request_rec *r, char *s)
: NULL, : NULL,
expires ? (exp_time ? exp_time : "") expires ? (exp_time ? exp_time : "")
: NULL, : NULL,
(secure && (!ap_casecmpstr(secure, "true") (secure && (!strcasecmp(secure, "true")
|| !strcmp(secure, "1") || !strcmp(secure, "1")
|| !ap_casecmpstr(secure, || !strcasecmp(secure,
"secure"))) ? "secure"))) ?
"; secure" : NULL, "; secure" : NULL,
(httponly && (!ap_casecmpstr(httponly, "true") (httponly && (!strcasecmp(httponly, "true")
|| !strcmp(httponly, "1") || !strcmp(httponly, "1")
|| !ap_casecmpstr(httponly, || !strcasecmp(httponly,
"HttpOnly"))) ? "HttpOnly"))) ?
"; HttpOnly" : NULL, "; HttpOnly" : NULL,
NULL); NULL);

View File

@@ -240,7 +240,7 @@ static int scan_meta_file(request_rec *r, apr_file_t *f)
while (apr_isspace(*l)) while (apr_isspace(*l))
++l; ++l;
if (!ap_casecmpstr(w, "Content-type")) { if (!strcasecmp(w, "Content-type")) {
char *tmp; char *tmp;
/* Nuke trailing whitespace */ /* 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_content_type_tolower(tmp);
ap_set_content_type(r, tmp); ap_set_content_type(r, tmp);
} }
else if (!ap_casecmpstr(w, "Status")) { else if (!strcasecmp(w, "Status")) {
sscanf(l, "%d", &r->status); sscanf(l, "%d", &r->status);
r->status_line = apr_pstrdup(r->pool, l); r->status_line = apr_pstrdup(r->pool, l);
} }

View File

@@ -789,14 +789,14 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers,
} }
break; break;
case hdr_set: case hdr_set:
if (!ap_casecmpstr(hdr->header, "Content-Type")) { if (!strcasecmp(hdr->header, "Content-Type")) {
ap_set_content_type(r, process_tags(hdr, r)); ap_set_content_type(r, process_tags(hdr, r));
} }
apr_table_setn(headers, hdr->header, process_tags(hdr, r)); apr_table_setn(headers, hdr->header, process_tags(hdr, r));
break; break;
case hdr_setifempty: case hdr_setifempty:
if (NULL == apr_table_get(headers, hdr->header)) { if (NULL == apr_table_get(headers, hdr->header)) {
if (!ap_casecmpstr(hdr->header, "Content-Type")) { if (!strcasecmp(hdr->header, "Content-Type")) {
ap_set_content_type(r, process_tags(hdr, r)); ap_set_content_type(r, process_tags(hdr, r));
} }
apr_table_setn(headers, hdr->header, 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; break;
case hdr_edit: case hdr_edit:
case hdr_edit_r: case hdr_edit_r:
if (!ap_casecmpstr(hdr->header, "Content-Type") && r->content_type) { if (!strcasecmp(hdr->header, "Content-Type") && r->content_type) {
const char *repl = process_regexp(hdr, r->content_type, r); const char *repl = process_regexp(hdr, r->content_type, r);
if (repl == NULL) if (repl == NULL)
return 0; return 0;

View File

@@ -633,15 +633,15 @@ static apr_status_t ajp_unmarshal_response(ajp_msg_t *msg,
} }
/* Set-Cookie need additional processing */ /* Set-Cookie need additional processing */
if (!ap_casecmpstr(stringname, "Set-Cookie")) { if (!strcasecmp(stringname, "Set-Cookie")) {
value = ap_proxy_cookie_reverse_map(r, dconf, value); value = ap_proxy_cookie_reverse_map(r, dconf, value);
} }
/* Location, Content-Location, URI and Destination need additional /* Location, Content-Location, URI and Destination need additional
* processing */ * processing */
else if (!ap_casecmpstr(stringname, "Location") else if (!strcasecmp(stringname, "Location")
|| !ap_casecmpstr(stringname, "Content-Location") || !strcasecmp(stringname, "Content-Location")
|| !ap_casecmpstr(stringname, "URI") || !strcasecmp(stringname, "URI")
|| !ap_casecmpstr(stringname, "Destination")) || !strcasecmp(stringname, "Destination"))
{ {
value = ap_proxy_location_reverse_map(r, dconf, value); 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); apr_table_add(r->headers_out, stringname, value);
/* Content-type needs an additional handling */ /* Content-type needs an additional handling */
if (ap_casecmpstr(stringname, "Content-Type") == 0) { if (strcasecmp(stringname, "Content-Type") == 0) {
/* add corresponding filter */ /* add corresponding filter */
ap_set_content_type(r, apr_pstrdup(r->pool, value)); ap_set_content_type(r, apr_pstrdup(r->pool, value));
ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r, ap_log_rerror(APLOG_MARK, APLOG_TRACE5, 0, r,

View File

@@ -1105,9 +1105,9 @@ static int proxy_handler(request_rec *r)
if (strcmp(ents[i].scheme, "*") == 0 || if (strcmp(ents[i].scheme, "*") == 0 ||
(ents[i].use_regex && (ents[i].use_regex &&
ap_regexec(ents[i].regexp, url, 0, NULL, 0) == 0) || ap_regexec(ents[i].regexp, url, 0, NULL, 0) == 0) ||
(p2 == NULL && ap_casecmpstr(scheme, ents[i].scheme) == 0) || (p2 == NULL && strcasecmp(scheme, ents[i].scheme) == 0) ||
(p2 != NULL && (p2 != NULL &&
ap_casecmpstrn(url, ents[i].scheme, strncasecmp(url, ents[i].scheme,
strlen(ents[i].scheme)) == 0)) { strlen(ents[i].scheme)) == 0)) {
/* handle the scheme */ /* 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 * We could be passed a URL during the config stage that contains
* the UDS path... ignore it * the UDS path... ignore it
*/ */
if (!ap_casecmpstrn(url, "unix:", 5) && if (!strncasecmp(url, "unix:", 5) &&
((ptr = ap_strchr_c(url, '|')) != NULL)) { ((ptr = ap_strchr_c(url, '|')) != NULL)) {
/* move past the 'unix:...|' UDS path info */ /* move past the 'unix:...|' UDS path info */
const char *ret, *c; const char *ret, *c;

View File

@@ -35,7 +35,7 @@ static int proxy_ajp_canon(request_rec *r, char *url)
apr_port_t port, def_port; apr_port_t port, def_port;
/* ap_port_of_scheme() */ /* ap_port_of_scheme() */
if (ap_casecmpstrn(url, "ajp:", 4) == 0) { if (strncasecmp(url, "ajp:", 4) == 0) {
url += 4; url += 4;
} }
else { else {
@@ -243,7 +243,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
/* read the first bloc of data */ /* read the first bloc of data */
input_brigade = apr_brigade_create(p, r->connection->bucket_alloc); input_brigade = apr_brigade_create(p, r->connection->bucket_alloc);
tenc = apr_table_get(r->headers_in, "Transfer-Encoding"); tenc = apr_table_get(r->headers_in, "Transfer-Encoding");
if (tenc && (ap_casecmpstr(tenc, "chunked") == 0)) { if (tenc && (strcasecmp(tenc, "chunked") == 0)) {
/* The AJP protocol does not want body data yet */ /* The AJP protocol does not want body data yet */
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00870) "request is chunked"); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00870) "request is chunked");
} else { } else {
@@ -746,7 +746,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
apr_pool_t *p = r->pool; apr_pool_t *p = r->pool;
apr_uri_t *uri; apr_uri_t *uri;
if (ap_casecmpstrn(url, "ajp:", 4) != 0) { if (strncasecmp(url, "ajp:", 4) != 0) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00894) "declining URL %s", url); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00894) "declining URL %s", url);
return DECLINED; return DECLINED;
} }

View File

@@ -63,7 +63,7 @@ static int proxy_balancer_canon(request_rec *r, char *url)
apr_port_t port = 0; apr_port_t port = 0;
/* TODO: offset of BALANCER_PREFIX ?? */ /* TODO: offset of BALANCER_PREFIX ?? */
if (ap_casecmpstrn(url, "balancer:", 9) == 0) { if (strncasecmp(url, "balancer:", 9) == 0) {
url += 9; url += 9;
} }
else { else {
@@ -1380,7 +1380,7 @@ static int balancer_handler(request_rec *r)
ap_rprintf(r, " <httpd:lbset>%d</httpd:lbset>\n", ap_rprintf(r, " <httpd:lbset>%d</httpd:lbset>\n",
worker->s->lbset); worker->s->lbset);
/* End proxy_worker_stat */ /* End proxy_worker_stat */
if (!ap_casecmpstr(worker->s->scheme, "ajp")) { if (!strcasecmp(worker->s->scheme, "ajp")) {
ap_rputs(" <httpd:flushpackets>", r); ap_rputs(" <httpd:flushpackets>", r);
switch (worker->s->flush_packets) { switch (worker->s->flush_packets) {
case flush_off: case flush_off:

View File

@@ -39,7 +39,7 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
fcgi_req_config_t *rconf = NULL; fcgi_req_config_t *rconf = NULL;
const char *pathinfo_type = NULL; const char *pathinfo_type = NULL;
if (ap_casecmpstrn(url, "fcgi:", 5) == 0) { if (strncasecmp(url, "fcgi:", 5) == 0) {
url += 5; url += 5;
} }
else { else {
@@ -878,7 +878,7 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
"url: %s proxyname: %s proxyport: %d", "url: %s proxyname: %s proxyport: %d",
url, proxyname, proxyport); url, proxyname, proxyport);
if (ap_casecmpstrn(url, "fcgi:", 5) != 0) { if (strncasecmp(url, "fcgi:", 5) != 0) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url);
return DECLINED; return DECLINED;
} }

View File

@@ -32,7 +32,7 @@ static int proxy_fdpass_canon(request_rec *r, char *url)
{ {
const char *path; const char *path;
if (ap_casecmpstrn(url, "fd://", 5) == 0) { if (strncasecmp(url, "fd://", 5) == 0) {
url += 5; url += 5;
} }
else { else {
@@ -132,7 +132,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
apr_socket_t *sock; apr_socket_t *sock;
apr_socket_t *clientsock; apr_socket_t *clientsock;
if (ap_casecmpstrn(url, "fd://", 5) == 0) { if (strncasecmp(url, "fd://", 5) == 0) {
url += 5; url += 5;
} }
else { else {

View File

@@ -294,7 +294,7 @@ static int proxy_ftp_canon(request_rec *r, char *url)
apr_port_t port, def_port; apr_port_t port, def_port;
/* */ /* */
if (ap_casecmpstrn(url, "ftp:", 4) == 0) { if (strncasecmp(url, "ftp:", 4) == 0) {
url += 4; url += 4;
} }
else { 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); 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 path began with /%2f, change the basedir */
if (ap_casecmpstrn(path, "/%2f", 4) == 0) { if (strncasecmp(path, "/%2f", 4) == 0) {
basedir = "/%2f"; basedir = "/%2f";
} }
@@ -1011,7 +1011,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
proxyhost); proxyhost);
return DECLINED; /* proxy connections are via HTTP */ return DECLINED; /* proxy connections are via HTTP */
} }
if (ap_casecmpstrn(url, "ftp:", 4)) { if (strncasecmp(url, "ftp:", 4)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
"declining URL %s - not ftp:", url); "declining URL %s - not ftp:", url);
return DECLINED; /* only interested in FTP */ 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. * still smaller that the URL is logged regularly.
*/ */
if ((password = apr_table_get(r->headers_in, "Authorization")) != NULL if ((password = apr_table_get(r->headers_in, "Authorization")) != NULL
&& ap_casecmpstr(ap_getword(r->pool, &password, ' '), "Basic") == 0 && strcasecmp(ap_getword(r->pool, &password, ' '), "Basic") == 0
&& (password = ap_pbase64decode(r->pool, password))[0] != ':') { && (password = ap_pbase64decode(r->pool, password))[0] != ':') {
/* Check the decoded string for special characters. */ /* Check the decoded string for special characters. */
if (!ftp_check_string(password)) { 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 /" /* Special handling for leading "%2f": this enforces a "cwd /"
* out of the $HOME directory which was the starting point after login * out of the $HOME directory which was the starting point after login
*/ */
if (ap_casecmpstrn(path, "%2f", 3) == 0) { if (strncasecmp(path, "%2f", 3) == 0) {
path += 3; path += 3;
while (*path == '/') /* skip leading '/' (after root %2f) */ while (*path == '/') /* skip leading '/' (after root %2f) */
++path; ++path;

View File

@@ -43,11 +43,11 @@ static int proxy_http_canon(request_rec *r, char *url)
apr_port_t port, def_port; apr_port_t port, def_port;
/* ap_port_of_scheme() */ /* ap_port_of_scheme() */
if (ap_casecmpstrn(url, "http:", 5) == 0) { if (strncasecmp(url, "http:", 5) == 0) {
url += 5; url += 5;
scheme = "http"; scheme = "http";
} }
else if (ap_casecmpstrn(url, "https:", 6) == 0) { else if (strncasecmp(url, "https:", 6) == 0) {
url += 6; url += 6;
scheme = "https"; 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 * encoding has been done by the extensions' handler, and
* do not modify add_te_chunked's logic * do not modify add_te_chunked's logic
*/ */
if (*old_te_val && ap_casecmpstr(*old_te_val, "chunked") != 0) { if (*old_te_val && strcasecmp(*old_te_val, "chunked") != 0) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01093) ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01093)
"%s Transfer-Encoding is not supported", *old_te_val); "%s Transfer-Encoding is not supported", *old_te_val);
return HTTP_INTERNAL_SERVER_ERROR; return HTTP_INTERNAL_SERVER_ERROR;
@@ -1113,14 +1113,14 @@ static void process_proxy_header(request_rec *r, proxy_dir_conf *c,
}; };
int i; int i;
for (i = 0; date_hdrs[i]; ++i) { for (i = 0; date_hdrs[i]; ++i) {
if (!ap_casecmpstr(date_hdrs[i], key)) { if (!strcasecmp(date_hdrs[i], key)) {
apr_table_add(r->headers_out, key, apr_table_add(r->headers_out, key,
date_canon(r->pool, value)); date_canon(r->pool, value));
return; return;
} }
} }
for (i = 0; transform_hdrs[i].name; ++i) { for (i = 0; transform_hdrs[i].name; ++i) {
if (!ap_casecmpstr(transform_hdrs[i].name, key)) { if (!strcasecmp(transform_hdrs[i].name, key)) {
apr_table_add(r->headers_out, key, apr_table_add(r->headers_out, key,
(*transform_hdrs[i].func)(r, c, value)); (*transform_hdrs[i].func)(r, c, value));
return; return;

View File

@@ -180,7 +180,7 @@ static int scgi_canon(request_rec *r, char *url)
const char *err, *path; const char *err, *path;
apr_port_t port, def_port; apr_port_t port, def_port;
if (ap_casecmpstrn(url, SCHEME "://", sizeof(SCHEME) + 2)) { if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
return DECLINED; return DECLINED;
} }
url += sizeof(SCHEME); /* Keep slashes */ url += sizeof(SCHEME); /* Keep slashes */
@@ -434,7 +434,7 @@ static int pass_response(request_rec *r, proxy_conn_rec *conn)
if (location && *location == '/') { if (location && *location == '/') {
scgi_request_config *req_conf = apr_palloc(r->pool, scgi_request_config *req_conf = apr_palloc(r->pool,
sizeof(*req_conf)); sizeof(*req_conf));
if (ap_casecmpstr(location_header, "Location")) { if (strcasecmp(location_header, "Location")) {
if (err) { if (err) {
apr_table_unset(r->err_headers_out, location_header); 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)); apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
char dummy; char dummy;
if (ap_casecmpstrn(url, SCHEME "://", sizeof(SCHEME) + 2)) { if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00865) ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00865)
"declining URL %s", url); "declining URL %s", url);
return DECLINED; return DECLINED;

View File

@@ -211,12 +211,12 @@ static int proxy_wstunnel_canon(request_rec *r, char *url)
apr_port_t port, def_port; apr_port_t port, def_port;
/* ap_port_of_scheme() */ /* ap_port_of_scheme() */
if (ap_casecmpstrn(url, "ws:", 3) == 0) { if (strncasecmp(url, "ws:", 3) == 0) {
url += 3; url += 3;
scheme = "ws:"; scheme = "ws:";
def_port = apr_uri_port_of_scheme("http"); def_port = apr_uri_port_of_scheme("http");
} }
else if (ap_casecmpstrn(url, "wss:", 4) == 0) { else if (strncasecmp(url, "wss:", 4) == 0) {
url += 4; url += 4;
scheme = "wss:"; scheme = "wss:";
def_port = apr_uri_port_of_scheme("https"); 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; apr_uri_t *uri;
int is_ssl = 0; int is_ssl = 0;
if (ap_casecmpstrn(url, "wss:", 4) == 0) { if (strncasecmp(url, "wss:", 4) == 0) {
scheme = "WSS"; scheme = "WSS";
is_ssl = 1; is_ssl = 1;
} }
else if (ap_casecmpstrn(url, "ws:", 3) == 0) { else if (strncasecmp(url, "ws:", 3) == 0) {
scheme = "WS"; scheme = "WS";
} }
else { else {
@@ -487,7 +487,7 @@ static int proxy_wstunnel_handler(request_rec *r, proxy_worker *worker,
} }
upgrade = apr_table_get(r->headers_in, "Upgrade"); upgrade = apr_table_get(r->headers_in, "Upgrade");
if (!upgrade || ap_casecmpstr(upgrade, "WebSocket") != 0) { if (!upgrade || strcasecmp(upgrade, "WebSocket") != 0) {
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02900) ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02900)
"declining URL %s (not WebSocket)", url); "declining URL %s (not WebSocket)", url);
return DECLINED; return DECLINED;

View File

@@ -151,40 +151,40 @@ static int copy_headers_in(void *vbaton, const char *key, const char *value)
switch (key[0]) { switch (key[0]) {
case 'a': case 'a':
case 'A': case 'A':
if (ap_casecmpstr("Accept-Encoding", key) == 0) { if (strcasecmp("Accept-Encoding", key) == 0) {
return 0; return 0;
} }
break; break;
case 'c': case 'c':
case 'C': case 'C':
if (ap_casecmpstr("Connection", key) == 0) { if (strcasecmp("Connection", key) == 0) {
return 0; return 0;
} }
break; break;
case 'h': case 'h':
case 'H': case 'H':
if (ap_casecmpstr("Host", key) == 0) { if (strcasecmp("Host", key) == 0) {
return 0; return 0;
} }
break; break;
case 'k': case 'k':
case 'K': case 'K':
if (ap_casecmpstr("Keep-Alive", key) == 0) { if (strcasecmp("Keep-Alive", key) == 0) {
return 0; return 0;
} }
break; break;
case 't': case 't':
case 'T': case 'T':
if (ap_casecmpstr("TE", key) == 0) { if (strcasecmp("TE", key) == 0) {
return 0; return 0;
} }
if (ap_casecmpstr("Trailer", key) == 0) { if (strcasecmp("Trailer", key) == 0) {
return 0; return 0;
} }
break; break;
case 'u': case 'u':
case 'U': case 'U':
if (ap_casecmpstr("Upgrade", key) == 0) { if (strcasecmp("Upgrade", key) == 0) {
return 0; return 0;
} }
break; break;
@@ -205,27 +205,27 @@ static int copy_headers_out(void *vbaton, const char *key, const char *value)
switch (key[0]) { switch (key[0]) {
case 'c': case 'c':
case 'C': case 'C':
if (ap_casecmpstr("Content-Type", key) == 0) { if (strcasecmp("Content-Type", key) == 0) {
ap_set_content_type(ctx->r, value); ap_set_content_type(ctx->r, value);
done = 1; done = 1;
break; break;
} }
else if (ap_casecmpstr("Connection", key) == 0) { else if (strcasecmp("Connection", key) == 0) {
done = 1; done = 1;
break; break;
} }
else if (ap_casecmpstr("Content-Encoding", key) == 0) { else if (strcasecmp("Content-Encoding", key) == 0) {
done = 1; done = 1;
break; break;
} }
else if (ap_casecmpstr("Content-Length", key) == 0) { else if (strcasecmp("Content-Length", key) == 0) {
done = 1; done = 1;
break; break;
} }
break; break;
case 't': case 't':
case 'T': case 'T':
if (ap_casecmpstr("Transfer-Encoding", key) == 0) { if (strcasecmp("Transfer-Encoding", key) == 0) {
done = 1; done = 1;
break; break;
} }
@@ -512,7 +512,7 @@ static int drive_serf(request_rec *r, serf_config_t *conf)
baton->done_headers = 0; baton->done_headers = 0;
baton->keep_reading = 1; baton->keep_reading = 1;
if (ap_casecmpstr(conf->url.scheme, "https") == 0) { if (strcasecmp(conf->url.scheme, "https") == 0) {
baton->want_ssl = 1; baton->want_ssl = 1;
} }
else { else {

View File

@@ -1074,7 +1074,7 @@ PROXY_DECLARE(int) ap_proxy_valid_balancer_name(char *name, int i)
{ {
if (!i) if (!i)
i = sizeof(BALANCER_PREFIX)-1; i = sizeof(BALANCER_PREFIX)-1;
return (!ap_casecmpstrn(name, BALANCER_PREFIX, i)); return (!strncasecmp(name, BALANCER_PREFIX, i));
} }
@@ -1677,7 +1677,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
if (ptr) { if (ptr) {
*ptr = '\0'; *ptr = '\0';
rv = apr_uri_parse(p, url, &urisock); rv = apr_uri_parse(p, url, &urisock);
if (rv == APR_SUCCESS && !ap_casecmpstr(urisock.scheme, "unix")) { if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "unix")) {
sockpath = ap_runtime_dir_relative(p, urisock.path);; sockpath = ap_runtime_dir_relative(p, urisock.path);;
url = ptr+1; /* so we get the scheme for the uds */ 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) ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02807)
"Removing header '%s' listed in Connection header", "Removing header '%s' listed in Connection header",
name); name);
if (!ap_casecmpstr(name, "close")) { if (!strcasecmp(name, "close")) {
closed = 1; closed = 1;
} }
apr_table_unset(headers, name); 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. */ /* Add the Expect header if not already there. */
if (((val = apr_table_get(r->headers_in, "Expect")) == NULL) if (((val = apr_table_get(r->headers_in, "Expect")) == NULL)
|| (ap_casecmpstr(val, "100-Continue") != 0 /* fast path */ || (strcasecmp(val, "100-Continue") != 0 /* fast path */
&& !ap_find_token(r->pool, val, "100-Continue"))) { && !ap_find_token(r->pool, val, "100-Continue"))) {
apr_table_mergen(r->headers_in, "Expect", "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 || headers_in[counter].val == NULL
/* Already sent */ /* Already sent */
|| !ap_casecmpstr(headers_in[counter].key, "Host") || !strcasecmp(headers_in[counter].key, "Host")
/* Clear out hop-by-hop request headers not to send /* Clear out hop-by-hop request headers not to send
* RFC2616 13.5.1 says we should strip these headers * RFC2616 13.5.1 says we should strip these headers
*/ */
|| !ap_casecmpstr(headers_in[counter].key, "Keep-Alive") || !strcasecmp(headers_in[counter].key, "Keep-Alive")
|| !ap_casecmpstr(headers_in[counter].key, "TE") || !strcasecmp(headers_in[counter].key, "TE")
|| !ap_casecmpstr(headers_in[counter].key, "Trailer") || !strcasecmp(headers_in[counter].key, "Trailer")
|| !ap_casecmpstr(headers_in[counter].key, "Upgrade") || !strcasecmp(headers_in[counter].key, "Upgrade")
) { ) {
continue; 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. * If we have used it then MAYBE: RFC2616 says we MAY propagate it.
* So let's make it configurable by env. * So let's make it configurable by env.
*/ */
if (!ap_casecmpstr(headers_in[counter].key,"Proxy-Authorization")) { if (!strcasecmp(headers_in[counter].key,"Proxy-Authorization")) {
if (r->user != NULL) { /* we've authenticated */ if (r->user != NULL) { /* we've authenticated */
if (!apr_table_get(r->subprocess_env, "Proxy-Chain-Auth")) { if (!apr_table_get(r->subprocess_env, "Proxy-Chain-Auth")) {
continue; continue;
@@ -3587,22 +3587,22 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
/* Skip Transfer-Encoding and Content-Length for now. /* Skip Transfer-Encoding and Content-Length for now.
*/ */
if (!ap_casecmpstr(headers_in[counter].key, "Transfer-Encoding")) { if (!strcasecmp(headers_in[counter].key, "Transfer-Encoding")) {
*old_te_val = headers_in[counter].val; *old_te_val = headers_in[counter].val;
continue; continue;
} }
if (!ap_casecmpstr(headers_in[counter].key, "Content-Length")) { if (!strcasecmp(headers_in[counter].key, "Content-Length")) {
*old_cl_val = headers_in[counter].val; *old_cl_val = headers_in[counter].val;
continue; continue;
} }
/* for sub-requests, ignore freshness/expiry headers */ /* for sub-requests, ignore freshness/expiry headers */
if (r->main) { if (r->main) {
if ( !ap_casecmpstr(headers_in[counter].key, "If-Match") if ( !strcasecmp(headers_in[counter].key, "If-Match")
|| !ap_casecmpstr(headers_in[counter].key, "If-Modified-Since") || !strcasecmp(headers_in[counter].key, "If-Modified-Since")
|| !ap_casecmpstr(headers_in[counter].key, "If-Range") || !strcasecmp(headers_in[counter].key, "If-Range")
|| !ap_casecmpstr(headers_in[counter].key, "If-Unmodified-Since") || !strcasecmp(headers_in[counter].key, "If-Unmodified-Since")
|| !ap_casecmpstr(headers_in[counter].key, "If-None-Match")) { || !strcasecmp(headers_in[counter].key, "If-None-Match")) {
continue; continue;
} }
} }
@@ -3687,7 +3687,7 @@ PROXY_DECLARE(apr_port_t) ap_proxy_port_of_scheme(const char *scheme)
} else { } else {
proxy_schemes_t *pscheme; proxy_schemes_t *pscheme;
for (pscheme = pschemes; pscheme->name != NULL; ++pscheme) { for (pscheme = pschemes; pscheme->name != NULL; ++pscheme) {
if (ap_casecmpstr(scheme, pscheme->name) == 0) { if (strcasecmp(scheme, pscheme->name) == 0) {
return pscheme->default_port; return pscheme->default_port;
} }
} }

View File

@@ -111,7 +111,7 @@ static int slotmem_filenames(apr_pool_t *pool,
{ {
const char *fname = NULL, *pname = NULL; const char *fname = NULL, *pname = NULL;
if (slotname && *slotname && ap_casecmpstr(slotname, "none") != 0) { if (slotname && *slotname && strcasecmp(slotname, "none") != 0) {
if (slotname[0] != '/') { if (slotname[0] != '/') {
#if !SLOTMEM_UNLINK_SEMANTIC #if !SLOTMEM_UNLINK_SEMANTIC
/* Each generation needs its own file name. */ /* Each generation needs its own file name. */

View File

@@ -544,7 +544,12 @@ static apr_status_t policy_nocache_out_filter(ap_filter_t *f,
char *header = apr_pstrdup(r->pool, pragma_header); char *header = apr_pstrdup(r->pool, pragma_header);
const char *token = apr_strtok(header, ", ", &last); const char *token = apr_strtok(header, ", ", &last);
while (token) { while (token) {
if (!ap_casecmpstr(token, "no-cache")) { /* handle most common quickest case... */
if (!strcmp(token, "no-cache")) {
fail = 1;
}
/* ...then try slowest case */
else if (!strcasecmp(token, "no-cache")) {
fail = 1; fail = 1;
} }
token = apr_strtok(NULL, ", ", &last); token = apr_strtok(NULL, ", ", &last);
@@ -558,7 +563,15 @@ static apr_status_t policy_nocache_out_filter(ap_filter_t *f,
switch (token[0]) { switch (token[0]) {
case 'n': case 'n':
case 'N': { case 'N': {
if (!ap_casecmpstrn(token, "no-cache", 8)) { /* 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 (token[8] == '=') { if (token[8] == '=') {
} }
else if (!token[8]) { else if (!token[8]) {
@@ -566,14 +579,19 @@ static apr_status_t policy_nocache_out_filter(ap_filter_t *f,
} }
break; break;
} }
else if (!ap_casecmpstr(token, "no-store")) { else if (!strcasecmp(token, "no-store")) {
fail = 1; fail = 1;
} }
break; break;
} }
case 'p': case 'p':
case 'P': { case 'P': {
if (!ap_casecmpstrn(token, "private", 7)) { /* handle most common quickest cases... */
if (!strcmp(token, "private")) {
fail = 1;
}
/* ...then try slowest cases */
else if (!strncasecmp(token, "private", 7)) {
if (token[7] == '=') { if (token[7] == '=') {
} }
else if (!token[7]) { else if (!token[7]) {
@@ -644,7 +662,13 @@ static apr_status_t policy_maxage_out_filter(ap_filter_t *f,
switch (token[0]) { switch (token[0]) {
case 'm': case 'm':
case 'M': { case 'M': {
if (!ap_casecmpstrn(token, "max-age", 7)) { /* 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 (token[7] == '=') { if (token[7] == '=') {
max_age = 1; max_age = 1;
max_age_value = apr_atoi64(token + 8); max_age_value = apr_atoi64(token + 8);
@@ -655,7 +679,14 @@ static apr_status_t policy_maxage_out_filter(ap_filter_t *f,
} }
case 's': case 's':
case 'S': { case 'S': {
if (!ap_casecmpstrn(token, "s-maxage", 8)) { 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 (token[8] == '=') { if (token[8] == '=') {
s_maxage = 1; s_maxage = 1;
s_maxage_value = apr_atoi64(token + 9); s_maxage_value = apr_atoi64(token + 9);

View File

@@ -627,7 +627,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
* expensive to do correctly (performing a complete SSL handshake) * expensive to do correctly (performing a complete SSL handshake)
* or cause log spam by doing incorrectly (simply sending EOF). */ * or cause log spam by doing incorrectly (simply sending EOF). */
lp = ap_listeners; lp = ap_listeners;
while (lp && lp->protocol && ap_casecmpstr(lp->protocol, "http") != 0) { while (lp && lp->protocol && strcasecmp(lp->protocol, "http") != 0) {
lp = lp->next; lp = lp->next;
} }
if (!lp) { if (!lp) {
@@ -675,7 +675,7 @@ static apr_status_t dummy_connection(ap_pod_t *pod)
return rv; return rv;
} }
if (lp->protocol && ap_casecmpstr(lp->protocol, "https") == 0) { if (lp->protocol && strcasecmp(lp->protocol, "https") == 0) {
/* Send a TLS 1.0 close_notify alert. This is perhaps the /* Send a TLS 1.0 close_notify alert. This is perhaps the
* "least wrong" way to open and cleanly terminate an SSL * "least wrong" way to open and cleanly terminate an SSL
* connection. It should "work" without noisy error logs if * connection. It should "work" without noisy error logs if

View File

@@ -526,7 +526,7 @@ AP_CORE_DECLARE(void) ap_parse_uri(request_rec *r, const char *uri)
if (status == APR_SUCCESS) { if (status == APR_SUCCESS) {
/* if it has a scheme we may need to do absoluteURI vhost stuff */ /* if it has a scheme we may need to do absoluteURI vhost stuff */
if (r->parsed_uri.scheme if (r->parsed_uri.scheme
&& !ap_casecmpstr(r->parsed_uri.scheme, ap_http_scheme(r))) { && !strcasecmp(r->parsed_uri.scheme, ap_http_scheme(r))) {
r->hostname = r->parsed_uri.hostname; r->hostname = r->parsed_uri.hostname;
} }
else if (r->method_number == M_CONNECT) { 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) if (3 == sscanf(r->protocol, "%4s/%u.%u", http, &major, &minor)
&& (ap_casecmpstr("http", http) == 0) && (strcasecmp("http", http) == 0)
&& (minor < HTTP_VERSION(1, 0)) ) { /* don't allow HTTP/0.1000 */ && (minor < HTTP_VERSION(1, 0)) ) { /* don't allow HTTP/0.1000 */
r->proto_num = HTTP_VERSION(major, minor); 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 * the final encoding ...; the server MUST respond with the 400
* (Bad Request) status code and then close the connection". * (Bad Request) status code and then close the connection".
*/ */
if (!(ap_casecmpstr(tenc, "chunked") == 0 /* fast path */ if (!(strcasecmp(tenc, "chunked") == 0 /* fast path */
|| ap_find_last_token(r->pool, tenc, "chunked"))) { || ap_find_last_token(r->pool, tenc, "chunked"))) {
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02539) ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(02539)
"client sent unknown Transfer-Encoding " "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 * unfortunately, to signal a poor man's mandatory extension that
* the server must understand or return 417 Expectation Failed. * the server must understand or return 417 Expectation Failed.
*/ */
if (ap_casecmpstr(expect, "100-continue") == 0) { if (strcasecmp(expect, "100-continue") == 0) {
r->expecting_100 = 1; r->expecting_100 = 1;
} }
else { else {
@@ -1418,7 +1418,7 @@ AP_DECLARE(int) ap_get_basic_auth_pw(request_rec *r, const char **pw)
: "Authorization"); : "Authorization");
const char *t; const char *t;
if (!(t = ap_auth_type(r)) || ap_casecmpstr(t, "Basic")) if (!(t = ap_auth_type(r)) || strcasecmp(t, "Basic"))
return DECLINED; return DECLINED;
if (!ap_auth_name(r)) { 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; return HTTP_UNAUTHORIZED;
} }
if (ap_casecmpstr(ap_getword(r->pool, &auth_line, ' '), "Basic")) { if (strcasecmp(ap_getword(r->pool, &auth_line, ' '), "Basic")) {
/* Client tried to authenticate using wrong auth scheme */ /* Client tried to authenticate using wrong auth scheme */
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00573) ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00573)
"client used wrong authentication scheme: %s", r->uri); "client used wrong authentication scheme: %s", r->uri);

View 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)) { while (*s && !TEST_CHAR(*s, T_HTTP_TOKEN_STOP)) {
++s; ++s;
} }
if (!ap_casecmpstrn((const char *)start_token, (const char *)tok, if (!strncasecmp((const char *)start_token, (const char *)tok,
s - start_token)) { s - start_token)) {
return 1; 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] == ','))) (lidx > 0 && !(apr_isspace(line[lidx - 1]) || line[lidx - 1] == ',')))
return 0; return 0;
return (ap_casecmpstrn(&line[lidx], tok, tlen) == 0); return (strncasecmp(&line[lidx], tok, tlen) == 0);
} }
AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *str) 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 */ /* sanity check - we only support forms for now */
ct = apr_table_get(r->headers_in, "Content-Type"); ct = apr_table_get(r->headers_in, "Content-Type");
if (!ct || ap_casecmpstrn("application/x-www-form-urlencoded", ct, 33)) { if (!ct || strncasecmp("application/x-www-form-urlencoded", ct, 33)) {
return ap_discard_request_body(r); return ap_discard_request_body(r);
} }

View File

@@ -1710,13 +1710,13 @@ static int op_T(ap_expr_eval_ctx_t *ctx, const void *data, const char *arg)
return FALSE; return FALSE;
case 'o': case 'o':
case 'O': case 'O':
return ap_casecmpstr(arg, "off") == 0 ? FALSE : TRUE; return strcasecmp(arg, "off") == 0 ? FALSE : TRUE;
case 'n': case 'n':
case 'N': case 'N':
return ap_casecmpstr(arg, "no") == 0 ? FALSE : TRUE; return strcasecmp(arg, "no") == 0 ? FALSE : TRUE;
case 'f': case 'f':
case 'F': case 'F':
return ap_casecmpstr(arg, "false") == 0 ? FALSE : TRUE; return strcasecmp(arg, "false") == 0 ? FALSE : TRUE;
case '0': case '0':
return arg[1] == '\0' ? FALSE : TRUE; return arg[1] == '\0' ? FALSE : TRUE;
default: default:
@@ -1824,7 +1824,7 @@ static int core_expr_lookup(ap_expr_lookup_parms *parms)
while (prov->func) { while (prov->func) {
const char **name = prov->names; const char **name = prov->names;
while (*name) { while (*name) {
if (ap_casecmpstr(*name, parms->name) == 0) { if (strcasecmp(*name, parms->name) == 0) {
*parms->func = prov->func; *parms->func = prov->func;
*parms->data = name; *parms->data = name;
return OK; return OK;
@@ -1857,7 +1857,7 @@ static int core_expr_lookup(ap_expr_lookup_parms *parms)
if (parms->type == AP_EXPR_FUNC_OP_UNARY) if (parms->type == AP_EXPR_FUNC_OP_UNARY)
match = !strcmp(prov->name, parms->name); match = !strcmp(prov->name, parms->name);
else else
match = !ap_casecmpstr(prov->name, parms->name); match = !strcasecmp(prov->name, parms->name);
if (match) { if (match) {
if ((parms->flags & AP_EXPR_FLAG_RESTRICTED) if ((parms->flags & AP_EXPR_FLAG_RESTRICTED)
&& prov->restricted) { && prov->restricted) {

View File

@@ -180,10 +180,10 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
* for no particular reason. * for no particular reason.
*/ */
if (!ap_casecmpstr(hdrs[i].key, "Content-type")) { if (!strcasecmp(hdrs[i].key, "Content-type")) {
apr_table_addn(e, "CONTENT_TYPE", hdrs[i].val); apr_table_addn(e, "CONTENT_TYPE", hdrs[i].val);
} }
else if (!ap_casecmpstr(hdrs[i].key, "Content-length")) { else if (!strcasecmp(hdrs[i].key, "Content-length")) {
apr_table_addn(e, "CONTENT_LENGTH", hdrs[i].val); 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... * in the environment with "ps -e". But, if you must...
*/ */
#ifndef SECURITY_HOLE_PASS_AUTHORIZATION #ifndef SECURITY_HOLE_PASS_AUTHORIZATION
else if (!ap_casecmpstr(hdrs[i].key, "Authorization") else if (!strcasecmp(hdrs[i].key, "Authorization")
|| !ap_casecmpstr(hdrs[i].key, "Proxy-Authorization")) { || !strcasecmp(hdrs[i].key, "Proxy-Authorization")) {
if (conf->cgi_pass_auth == AP_CGI_PASS_AUTH_ON) { if (conf->cgi_pass_auth == AP_CGI_PASS_AUTH_ON) {
add_unless_null(e, http2env(r, hdrs[i].key), hdrs[i].val); 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; ++l;
} }
if (!ap_casecmpstr(w, "Content-type")) { if (!strcasecmp(w, "Content-type")) {
char *tmp; char *tmp;
/* Nuke trailing whitespace */ /* 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 * If the script returned a specific status, that's what
* we'll use - otherwise we assume 200 OK. * we'll use - otherwise we assume 200 OK.
*/ */
else if (!ap_casecmpstr(w, "Status")) { else if (!strcasecmp(w, "Status")) {
r->status = cgi_status = atoi(l); r->status = cgi_status = atoi(l);
if (!ap_is_HTTP_VALID_RESPONSE(cgi_status)) if (!ap_is_HTTP_VALID_RESPONSE(cgi_status))
ap_log_rerror(SCRIPT_LOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r, 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); apr_filepath_name_get(r->filename), l);
r->status_line = apr_pstrdup(r->pool, l); r->status_line = apr_pstrdup(r->pool, l);
} }
else if (!ap_casecmpstr(w, "Location")) { else if (!strcasecmp(w, "Location")) {
apr_table_set(r->headers_out, w, l); apr_table_set(r->headers_out, w, l);
} }
else if (!ap_casecmpstr(w, "Content-Length")) { else if (!strcasecmp(w, "Content-Length")) {
apr_table_set(r->headers_out, w, l); apr_table_set(r->headers_out, w, l);
} }
else if (!ap_casecmpstr(w, "Content-Range")) { else if (!strcasecmp(w, "Content-Range")) {
apr_table_set(r->headers_out, w, l); apr_table_set(r->headers_out, w, l);
} }
else if (!ap_casecmpstr(w, "Transfer-Encoding")) { else if (!strcasecmp(w, "Transfer-Encoding")) {
apr_table_set(r->headers_out, w, l); apr_table_set(r->headers_out, w, l);
} }
else if (!ap_casecmpstr(w, "ETag")) { else if (!strcasecmp(w, "ETag")) {
apr_table_set(r->headers_out, w, l); apr_table_set(r->headers_out, w, l);
} }
/* /*
* If the script gave us a Last-Modified header, we can't just * If the script gave us a Last-Modified header, we can't just
* pass it on blindly because of restrictions on future values. * pass it on blindly because of restrictions on future values.
*/ */
else if (!ap_casecmpstr(w, "Last-Modified")) { else if (!strcasecmp(w, "Last-Modified")) {
ap_update_mtime(r, apr_date_parse_http(l)); ap_update_mtime(r, apr_date_parse_http(l));
ap_set_last_modified(r); ap_set_last_modified(r);
} }
else if (!ap_casecmpstr(w, "Set-Cookie")) { else if (!strcasecmp(w, "Set-Cookie")) {
apr_table_add(cookie_table, w, l); apr_table_add(cookie_table, w, l);
} }
else { else {