ngx_strcasecmp()/ngx_strncasecmp()
diff --git a/src/http/modules/ngx_http_addition_filter_module.c b/src/http/modules/ngx_http_addition_filter_module.c index 5025f56..9480082 100644 --- a/src/http/modules/ngx_http_addition_filter_module.c +++ b/src/http/modules/ngx_http_addition_filter_module.c
@@ -100,8 +100,8 @@ return ngx_http_next_header_filter(r); } - if (ngx_strncasecmp(r->headers_out.content_type.data, "text/html", - sizeof("text/html") - 1) + if (ngx_strncasecmp(r->headers_out.content_type.data, + (u_char *) "text/html", sizeof("text/html") - 1) != 0) { return ngx_http_next_header_filter(r);
diff --git a/src/http/modules/ngx_http_charset_filter_module.c b/src/http/modules/ngx_http_charset_filter_module.c index cae9bbe..0139cc6 100644 --- a/src/http/modules/ngx_http_charset_filter_module.c +++ b/src/http/modules/ngx_http_charset_filter_module.c
@@ -239,8 +239,10 @@ } else { ct = r->headers_out.content_type.data; - if (ngx_strncasecmp(ct, "text/", 5) != 0 - && ngx_strncasecmp(ct, "application/x-javascript", 24) != 0) + if (ngx_strncasecmp(ct, (u_char *) "text/", 5) != 0 + && ngx_strncasecmp(ct, + (u_char *) "application/x-javascript", 24) + != 0) { return ngx_http_next_header_filter(r); } @@ -1118,7 +1120,7 @@ table->src = src; table->dst = dst; - if (ngx_strcasecmp(value[2].data, "utf-8") == 0) { + if (ngx_strcasecmp(value[2].data, (u_char *) "utf-8") == 0) { table->src2dst = ngx_pcalloc(cf->pool, 256 * NGX_UTF_LEN); if (table->src2dst == NULL) { return NGX_CONF_ERROR; @@ -1372,7 +1374,7 @@ c->name = *name; c->length = 0; - if (ngx_strcasecmp(name->data, "utf-8") == 0) { + if (ngx_strcasecmp(name->data, (u_char *) "utf-8") == 0) { c->utf8 = 1; } else {
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c index 8d17b43..599bd14 100644 --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -411,7 +411,7 @@ value = cf->args->elts; - if (ngx_strcasecmp(value[1].data, "cache-control") == 0) { + if (ngx_strcasecmp(value[1].data, (u_char *) "cache-control") == 0) { hcf->cache_control = value[2]; return NGX_CONF_OK; }
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c index 63ee8fd..cbd2ce8 100644 --- a/src/http/modules/ngx_http_proxy_module.c +++ b/src/http/modules/ngx_http_proxy_module.c
@@ -2111,11 +2111,11 @@ url = &value[1]; - if (ngx_strncasecmp(url->data, "http://", 7) == 0) { + if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) { add = 7; port = 80; - } else if (ngx_strncasecmp(url->data, "https://", 8) == 0) { + } else if (ngx_strncasecmp(url->data, (u_char *) "https://", 8) == 0) { #if (NGX_HTTP_SSL)
diff --git a/src/http/modules/ngx_http_range_filter_module.c b/src/http/modules/ngx_http_range_filter_module.c index 0c945d8..62b537f 100644 --- a/src/http/modules/ngx_http_range_filter_module.c +++ b/src/http/modules/ngx_http_range_filter_module.c
@@ -152,7 +152,9 @@ if (r->headers_in.range == NULL || r->headers_in.range->value.len < 7 - || ngx_strncasecmp(r->headers_in.range->value.data, "bytes=", 6) != 0) + || ngx_strncasecmp(r->headers_in.range->value.data, + (u_char *) "bytes=", 6) + != 0) { r->headers_out.accept_ranges = ngx_list_push(&r->headers_out.headers); if (r->headers_out.accept_ranges == NULL) {
diff --git a/src/http/modules/ngx_http_referer_module.c b/src/http/modules/ngx_http_referer_module.c index f3597a1..b2c2ef5 100644 --- a/src/http/modules/ngx_http_referer_module.c +++ b/src/http/modules/ngx_http_referer_module.c
@@ -106,7 +106,7 @@ ref = r->headers_in.referer->value.data; if (len < sizeof("http://i.ru") - 1 - || (ngx_strncasecmp(ref, "http://", 7) != 0)) + || (ngx_strncasecmp(ref, (u_char *) "http://", 7) != 0)) { if (rlcf->blocked_referer) { goto valid;
diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c index c8e11bf..e1d0e92 100644 --- a/src/http/modules/ngx_http_ssi_filter_module.c +++ b/src/http/modules/ngx_http_ssi_filter_module.c
@@ -1890,10 +1890,13 @@ return NGX_HTTP_SSI_ERROR; } - if (wait->len == 2 && ngx_strncasecmp(wait->data, "no", 2) == 0) { + if (wait->len == 2 + && ngx_strncasecmp(wait->data, (u_char *) "no", 2) == 0) + { wait = NULL; - } else if (wait->len != 3 || ngx_strncasecmp(wait->data, "yes", 3) != 0) + } else if (wait->len != 3 + || ngx_strncasecmp(wait->data, (u_char *) "yes", 3) != 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "invalid value \"%V\" in the \"wait\" parameter",
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index c35ccac..0a686c3 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c
@@ -12,7 +12,7 @@ typedef struct { - char *name; + u_char *name; uint32_t method; } ngx_http_method_name_t; @@ -1247,7 +1247,9 @@ encoded = r->headers_in.authorization->value; if (encoded.len < sizeof("Basic ") - 1 - || ngx_strncasecmp(encoded.data, "Basic ", sizeof("Basic ") - 1) != 0) + || ngx_strncasecmp(encoded.data, (u_char *) "Basic ", + sizeof("Basic ") - 1) + != 0) { r->headers_in.user.data = (u_char *) ""; return NGX_DECLINED; @@ -2681,19 +2683,19 @@ static ngx_http_method_name_t ngx_methods_names[] = { - { "GET", (uint32_t) ~NGX_HTTP_GET }, - { "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, - { "POST", (uint32_t) ~NGX_HTTP_POST }, - { "PUT", (uint32_t) ~NGX_HTTP_PUT }, - { "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, - { "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, - { "COPY", (uint32_t) ~NGX_HTTP_COPY }, - { "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, - { "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, - { "PROPFIND" , (uint32_t) ~NGX_HTTP_PROPFIND }, - { "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, - { "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, - { "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, + { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, + { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, + { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, + { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, + { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, + { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, + { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, + { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, + { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, + { (u_char *) "PROPFIND" , (uint32_t) ~NGX_HTTP_PROPFIND }, + { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, + { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, + { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, { NULL, 0 } };
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index d37fead..b366f79 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c
@@ -1285,14 +1285,16 @@ if (r->headers_in.connection) { if (r->headers_in.connection->value.len == 5 - && ngx_strcasecmp(r->headers_in.connection->value.data, "close") + && ngx_strcasecmp(r->headers_in.connection->value.data, + (u_char *) "close") == 0) { r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; } else if (r->headers_in.connection->value.len == 10 && ngx_strcasecmp(r->headers_in.connection->value.data, - "keep-alive") == 0) + (u_char *) "keep-alive") + == 0) { r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE;
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 5286000..79d372c 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c
@@ -2313,7 +2313,7 @@ while (*++p == ' ') { /* void */ } - if (ngx_strncasecmp(p, "charset=", 8) != 0) { + if (ngx_strncasecmp(p, (u_char *) "charset=", 8) != 0) { continue; }