resolver: fixed styles.

pull/348/head
Datong Sun 8 years ago
parent 3135bb8450
commit ef346b7556
No known key found for this signature in database
GPG Key ID: 1908AE626BFCE242

@ -1,5 +1,5 @@
diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c
index cd55520c..d91c406c 100644 index cd55520c..9156fadd 100644
--- a/src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c
+++ b/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
@ -25,7 +25,7 @@ index cd55520c..d91c406c 100644
typedef struct { typedef struct {
u_char ident_hi; u_char ident_hi;
@@ -131,6 +140,180 @@ static ngx_resolver_node_t *ngx_resolver_lookup_addr6(ngx_resolver_t *r, @@ -131,6 +140,182 @@ static ngx_resolver_node_t *ngx_resolver_lookup_addr6(ngx_resolver_t *r,
#endif #endif
@ -127,15 +127,17 @@ index cd55520c..d91c406c 100644
+ ngx_memzero(&u, sizeof(ngx_url_t)); + ngx_memzero(&u, sizeof(ngx_url_t));
+ +
+ u.url.data = buf + address; + u.url.data = buf + address;
+ u.url.len = i == n - 1 ? n - address : i - address; + u.url.len = (i == n - 1) ? n - address : i - address;
+ u.default_port = 53; + u.default_port = 53;
+ +
+ /* IPv6? */ + /* IPv6? */
+ if (ngx_strlchr(u.url.data, u.url.data + u.url.len, ':') != NULL) { + if (ngx_strlchr(u.url.data, u.url.data + u.url.len,
+ ':') != NULL)
+ {
+ if (u.url.len + 2 > sizeof(ipv6_buf)) { + if (u.url.len + 2 > sizeof(ipv6_buf)) {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "IPv6 resolver address is too long: \"%V\"", + "IPv6 resolver address is too long:"
+ &u.url); + " \"%V\"", &u.url);
+ +
+ return NGX_ERROR; + return NGX_ERROR;
+ } + }
@ -206,7 +208,7 @@ index cd55520c..d91c406c 100644
ngx_resolver_t * ngx_resolver_t *
ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n) ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
{ {
@@ -246,6 +429,35 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n) @@ -246,6 +431,37 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n)
} }
#endif #endif
@ -214,8 +216,10 @@ index cd55520c..d91c406c 100644
+ +
+ if (ngx_strcmp(&names[i].data[6], "on") == 0) { + if (ngx_strcmp(&names[i].data[6], "on") == 0) {
+ if (ngx_resolver_read_resolv_conf(cf, r, + if (ngx_resolver_read_resolv_conf(cf, r,
+ (u_char *) NGX_RESOLVER_FILE_NAME, + (u_char *)
+ sizeof(NGX_RESOLVER_FILE_NAME) - 1) + NGX_RESOLVER_FILE_NAME,
+ sizeof(NGX_RESOLVER_FILE_NAME)
+ - 1)
+ != NGX_OK) + != NGX_OK)
+ { + {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,

Loading…
Cancel
Save