comparison 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
comparison
equal deleted inserted replaced
3515:76d252724db5 3516:dd1570b6f237
346 if (r->headers_out.www_authenticate == NULL) { 346 if (r->headers_out.www_authenticate == NULL) {
347 return NGX_HTTP_INTERNAL_SERVER_ERROR; 347 return NGX_HTTP_INTERNAL_SERVER_ERROR;
348 } 348 }
349 349
350 r->headers_out.www_authenticate->hash = 1; 350 r->headers_out.www_authenticate->hash = 1;
351 r->headers_out.www_authenticate->key.len = sizeof("WWW-Authenticate") - 1; 351 ngx_str_set(&r->headers_out.www_authenticate->key, "WWW-Authenticate");
352 r->headers_out.www_authenticate->key.data = (u_char *) "WWW-Authenticate";
353 r->headers_out.www_authenticate->value = *realm; 352 r->headers_out.www_authenticate->value = *realm;
354 353
355 return NGX_HTTP_UNAUTHORIZED; 354 return NGX_HTTP_UNAUTHORIZED;
356 } 355 }
357 356
423 422
424 size_t len; 423 size_t len;
425 u_char *basic, *p; 424 u_char *basic, *p;
426 425
427 if (ngx_strcmp(realm->data, "off") == 0) { 426 if (ngx_strcmp(realm->data, "off") == 0) {
428 realm->len = 0; 427 ngx_str_set(realm, "");
429 realm->data = (u_char *) "";
430
431 return NGX_CONF_OK; 428 return NGX_CONF_OK;
432 } 429 }
433 430
434 len = sizeof("Basic realm=\"") - 1 + realm->len + 1; 431 len = sizeof("Basic realm=\"") - 1 + realm->len + 1;
435 432