Mercurial > hg > nginx-ranges
comparison src/http/ngx_http_variables.c @ 88:e916a291e9aa NGINX_0_1_44
nginx 0.1.44
*) Feature: the IMAP/POP3 proxy supports SSL.
*) Feature: the "proxy_timeout" directive of the ngx_imap_proxy_module.
*) Feature: the "userid_mark" directive.
*) Feature: the $remote_user variable value is determined independently
of authorization use.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 06 Sep 2005 00:00:00 +0400 |
parents | 2aa14f638cf0 |
children | f63280c59dd5 |
comparison
equal
deleted
inserted
replaced
87:5b7ec80c3c40 | 88:e916a291e9aa |
---|---|
30 ngx_http_variable_server_port(ngx_http_request_t *r, uintptr_t data); | 30 ngx_http_variable_server_port(ngx_http_request_t *r, uintptr_t data); |
31 static ngx_http_variable_value_t * | 31 static ngx_http_variable_value_t * |
32 ngx_http_variable_document_root(ngx_http_request_t *r, uintptr_t data); | 32 ngx_http_variable_document_root(ngx_http_request_t *r, uintptr_t data); |
33 static ngx_http_variable_value_t * | 33 static ngx_http_variable_value_t * |
34 ngx_http_variable_request_filename(ngx_http_request_t *r, uintptr_t data); | 34 ngx_http_variable_request_filename(ngx_http_request_t *r, uintptr_t data); |
35 static ngx_http_variable_value_t * | |
36 ngx_http_variable_remote_user(ngx_http_request_t *r, uintptr_t data); | |
35 | 37 |
36 | 38 |
37 /* | 39 /* |
38 * TODO: | 40 * TODO: |
39 * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED | 41 * Apache CGI: AUTH_TYPE, PATH_INFO (null), PATH_TRANSLATED |
106 offsetof(ngx_http_request_t, server_name), 0, 0 }, | 108 offsetof(ngx_http_request_t, server_name), 0, 0 }, |
107 | 109 |
108 { ngx_string("request_method"), ngx_http_variable_request, | 110 { ngx_string("request_method"), ngx_http_variable_request, |
109 offsetof(ngx_http_request_t, method_name), 0, 0 }, | 111 offsetof(ngx_http_request_t, method_name), 0, 0 }, |
110 | 112 |
111 { ngx_string("remote_user"), ngx_http_variable_request, | 113 { ngx_string("remote_user"), ngx_http_variable_remote_user, 0, 0, 0 }, |
112 offsetof(ngx_http_request_t, headers_in.user), 0, 0 }, | |
113 | 114 |
114 { ngx_null_string, NULL, 0, 0, 0 } | 115 { ngx_null_string, NULL, 0, 0, 0 } |
115 }; | 116 }; |
116 | 117 |
117 | 118 |
655 | 656 |
656 return vv; | 657 return vv; |
657 } | 658 } |
658 | 659 |
659 | 660 |
661 static ngx_http_variable_value_t * | |
662 ngx_http_variable_remote_user(ngx_http_request_t *r, uintptr_t data) | |
663 { | |
664 ngx_int_t rc; | |
665 ngx_http_variable_value_t *vv; | |
666 | |
667 rc = ngx_http_auth_basic_user(r); | |
668 | |
669 if (rc == NGX_DECLINED) { | |
670 return NGX_HTTP_VAR_NOT_FOUND; | |
671 } | |
672 | |
673 if (rc == NGX_ERROR) { | |
674 return NULL; | |
675 } | |
676 | |
677 vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t)); | |
678 if (vv == NULL) { | |
679 return NULL; | |
680 } | |
681 | |
682 vv->value = 0; | |
683 vv->text = r->headers_in.user; | |
684 | |
685 return vv; | |
686 } | |
687 | |
688 | |
660 ngx_int_t | 689 ngx_int_t |
661 ngx_http_variables_add_core_vars(ngx_conf_t *cf) | 690 ngx_http_variables_add_core_vars(ngx_conf_t *cf) |
662 { | 691 { |
663 ngx_http_variable_t *v, *cv; | 692 ngx_http_variable_t *v, *cv; |
664 ngx_http_core_main_conf_t *cmcf; | 693 ngx_http_core_main_conf_t *cmcf; |