}
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 */
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);
}
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;
}
}
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;
}
}
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;
}
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);
}
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);
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");
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");
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);
}
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 */
}
}
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;
*/
/* 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 {
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>";
}
{
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;
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 {
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;
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 {
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;
}
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 {
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);
}
}
}
- 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;
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";
}
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
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.
*/
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 */
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 */
}
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;
}
/* 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;
}
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;
}
*/
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;
}
}
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;
*/
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;
}
}
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));
}
{
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 {
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 */
{
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 {
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
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";
switch (*uri++) {
case 'a':
case 'A':
- if (!strncasecmp(uri, "jp://", 5)) { /* ajp:// */
+ if (!ap_casecmpstrn(uri, "jp://", 5)) { /* ajp:// */
*sqs = 1;
return 6;
}
case 'b':
case 'B':
- if (!strncasecmp(uri, "alancer://", 10)) { /* balancer:// */
+ if (!ap_casecmpstrn(uri, "alancer://", 10)) { /* balancer:// */
*sqs = 1;
return 11;
}
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;
}
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;
}
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;
}
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;
}
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;
}
* [dn ["?" [attributes] ["?" [scope]
* ["?" [filter] ["?" extensions]]]]]]
*/
- if (!strncasecmp(uri, "ldap", 4)) {
+ if (!ap_casecmpstrn(uri, "ldap", 4)) {
char *token[5];
int c = 0;
}
/* catch the "failed" case */
- if (i == 4 && !strcasecmp(buf, "NULL")) {
+ if (i == 4 && !ap_casecmpstr(buf, "NULL")) {
return NULL;
}
/* 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);
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);
}
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);
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 == '/') {
: 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);
while (apr_isspace(*l))
++l;
- if (!strcasecmp(w, "Content-type")) {
+ if (!ap_casecmpstr(w, "Content-type")) {
char *tmp;
/* Nuke trailing whitespace */
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);
}
}
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));
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;
}
/* 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);
}
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,
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 */
* 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;
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 {
/* 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 {
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;
}
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 {
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:
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 {
"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;
}
{
const char *path;
- if (strncasecmp(url, "fd://", 5) == 0) {
+ if (ap_casecmpstrn(url, "fd://", 5) == 0) {
url += 5;
}
else {
apr_socket_t *sock;
apr_socket_t *clientsock;
- if (strncasecmp(url, "fd://", 5) == 0) {
+ if (ap_casecmpstrn(url, "fd://", 5) == 0) {
url += 5;
}
else {
apr_port_t port, def_port;
/* */
- if (strncasecmp(url, "ftp:", 4) == 0) {
+ if (ap_casecmpstrn(url, "ftp:", 4) == 0) {
url += 4;
}
else {
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";
}
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 */
* 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)) {
/* 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;
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";
}
* 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;
};
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;
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 */
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);
}
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;
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");
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 {
}
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;
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;
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;
}
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 {
{
if (!i)
i = sizeof(BALANCER_PREFIX)-1;
- return (!strncasecmp(name, BALANCER_PREFIX, i));
+ return (!ap_casecmpstrn(name, BALANCER_PREFIX, i));
}
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 */
}
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);
/* 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");
}
|| 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;
* 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;
/* 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;
}
}
} 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;
}
}
{
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. */
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);
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]) {
}
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]) {
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);
}
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);
* 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) {
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
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) {
}
}
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);
}
* 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 "
* 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 {
: "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)) {
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);
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;
}
(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)
/* 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);
}
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:
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;
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) {
* 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);
}
/*
* 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);
}
++l;
}
- if (!strcasecmp(w, "Content-type")) {
+ if (!ap_casecmpstr(w, "Content-type")) {
char *tmp;
/* Nuke trailing whitespace */
* 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,
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 {