diff src/http/modules/ngx_http_auth_basic_module.c @ 3516:dd1570b6f237

ngx_str_set() and ngx_str_null()
author Igor Sysoev <igor@sysoev.ru>
date Fri, 14 May 2010 09:56:37 +0000
parents c7d57b539248
children e7798b5e990a
line wrap: on
line diff
--- a/src/http/modules/ngx_http_auth_basic_module.c
+++ b/src/http/modules/ngx_http_auth_basic_module.c
@@ -348,8 +348,7 @@ ngx_http_auth_basic_set_realm(ngx_http_r
     }
 
     r->headers_out.www_authenticate->hash = 1;
-    r->headers_out.www_authenticate->key.len = sizeof("WWW-Authenticate") - 1;
-    r->headers_out.www_authenticate->key.data = (u_char *) "WWW-Authenticate";
+    ngx_str_set(&r->headers_out.www_authenticate->key, "WWW-Authenticate");
     r->headers_out.www_authenticate->value = *realm;
 
     return NGX_HTTP_UNAUTHORIZED;
@@ -425,9 +424,7 @@ ngx_http_auth_basic(ngx_conf_t *cf, void
     u_char  *basic, *p;
 
     if (ngx_strcmp(realm->data, "off") == 0) {
-        realm->len = 0;
-        realm->data = (u_char *) "";
-
+        ngx_str_set(realm, "");
         return NGX_CONF_OK;
     }