[nginx] Resolver: lookups are case-insensitive.

Ruslan Ermilov ru at nginx.com
Fri Dec 13 16:54:52 UTC 2013


details:   http://hg.nginx.org/nginx/rev/c0d6eae5a1c5
branches:  
changeset: 5479:c0d6eae5a1c5
user:      Ruslan Ermilov <ru at nginx.com>
date:      Fri Dec 13 20:49:52 2013 +0400
description:
Resolver: lookups are case-insensitive.

diffstat:

 src/core/ngx_resolver.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (39 lines):

diff -r 3cb3175a6fef -r c0d6eae5a1c5 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c	Mon Dec 09 10:53:30 2013 +0400
+++ b/src/core/ngx_resolver.c	Fri Dec 13 20:49:52 2013 +0400
@@ -467,6 +467,8 @@ ngx_resolve_name_locked(ngx_resolver_t *
     ngx_resolver_ctx_t   *next;
     ngx_resolver_node_t  *rn;
 
+    ngx_strlow(ctx->name.data, ctx->name.data, ctx->name.len);
+
     hash = ngx_crc32_short(ctx->name.data, ctx->name.len);
 
     rn = ngx_resolver_lookup_name(r, &ctx->name, hash);
@@ -2011,7 +2013,7 @@ ngx_resolver_process_ptr(ngx_resolver_t 
         i += len;
     }
 
-    if (ngx_strcmp(&buf[i], "\7in-addr\4arpa") == 0) {
+    if (ngx_strcasecmp(&buf[i], (u_char *) "\7in-addr\4arpa") == 0) {
         i += sizeof("\7in-addr\4arpa");
 
         /* lock addr mutex */
@@ -2058,7 +2060,7 @@ invalid_in_addr_arpa:
         addr6.s6_addr[octet] += (u_char) (digit * 16);
     }
 
-    if (ngx_strcmp(&buf[i], "\3ip6\4arpa") == 0) {
+    if (ngx_strcasecmp(&buf[i], (u_char *) "\3ip6\4arpa") == 0) {
         i += sizeof("\3ip6\4arpa");
 
         /* lock addr mutex */
@@ -2737,7 +2739,7 @@ done:
             n = *src++;
 
         } else {
-            ngx_memcpy(dst, src, n);
+            ngx_strlow(dst, src, n);
             dst += n;
             src += n;
 



More information about the nginx-devel mailing list