comparison src/http/ngx_http_core_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 81457372d938
children 84905c7b2aa7
comparison
equal deleted inserted replaced
3515:76d252724db5 3516:dd1570b6f237
1683 void 1683 void
1684 ngx_http_set_exten(ngx_http_request_t *r) 1684 ngx_http_set_exten(ngx_http_request_t *r)
1685 { 1685 {
1686 ngx_int_t i; 1686 ngx_int_t i;
1687 1687
1688 r->exten.len = 0; 1688 ngx_str_null(&r->exten);
1689 r->exten.data = NULL;
1690 1689
1691 for (i = r->uri.len - 1; i > 1; i--) { 1690 for (i = r->uri.len - 1; i > 1; i--) {
1692 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { 1691 if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
1693 1692
1694 r->exten.len = r->uri.len - i - 1; 1693 r->exten.len = r->uri.len - i - 1;
2185 2184
2186 if (args) { 2185 if (args) {
2187 r->args = *args; 2186 r->args = *args;
2188 2187
2189 } else { 2188 } else {
2190 r->args.len = 0; 2189 ngx_str_null(&r->args);
2191 r->args.data = NULL;
2192 } 2190 }
2193 2191
2194 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 2192 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2195 "internal redirect: \"%V?%V\"", uri, &r->args); 2193 "internal redirect: \"%V?%V\"", uri, &r->args);
2196 2194
3030 conf->root = prev->root; 3028 conf->root = prev->root;
3031 conf->root_lengths = prev->root_lengths; 3029 conf->root_lengths = prev->root_lengths;
3032 conf->root_values = prev->root_values; 3030 conf->root_values = prev->root_values;
3033 3031
3034 if (prev->root.data == NULL) { 3032 if (prev->root.data == NULL) {
3035 conf->root.len = sizeof("html") - 1; 3033 ngx_str_set(&conf->root, "html");
3036 conf->root.data = (u_char *) "html";
3037 3034
3038 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) { 3035 if (ngx_conf_full_name(cf->cycle, &conf->root, 0) != NGX_OK) {
3039 return NGX_CONF_ERROR; 3036 return NGX_CONF_ERROR;
3040 } 3037 }
3041 } 3038 }
3889 3886
3890 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { 3887 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
3891 return NGX_CONF_ERROR; 3888 return NGX_CONF_ERROR;
3892 } 3889 }
3893 3890
3894 args.len = 0; 3891 ngx_str_null(&args);
3895 args.data = NULL;
3896 3892
3897 if (cv.lengths == NULL && uri.data[0] == '/') { 3893 if (cv.lengths == NULL && uri.data[0] == '/') {
3898 p = (u_char *) ngx_strchr(uri.data, '?'); 3894 p = (u_char *) ngx_strchr(uri.data, '?');
3899 3895
3900 if (p) { 3896 if (p) {