r->srv_conf = cscf->ctx->srv_conf;
r->loc_conf = cscf->ctx->loc_conf;
- r->server_name = cscf->server_name;
-
rev->handler = ngx_http_process_request_line;
#if (NGX_HTTP_SSL)
found:
- r->server_name.len = len;
- r->server_name.data = host;
-
r->srv_conf = cscf->ctx->srv_conf;
r->loc_conf = cscf->ctx->loc_conf;
ngx_http_log_error_handler(ngx_http_request_t *r, ngx_http_request_t *sr,
u_char *buf, size_t len)
{
- char *uri_separator;
- u_char *p;
- ngx_http_upstream_t *u;
+ char *uri_separator;
+ u_char *p;
+ ngx_http_upstream_t *u;
+ ngx_http_core_srv_conf_t *cscf;
- if (r->server_name.data) {
- p = ngx_snprintf(buf, len, ", server: %V", &r->server_name);
- len -= p - buf;
- buf = p;
- }
+ cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+
+ p = ngx_snprintf(buf, len, ", server: %V", &cscf->server_name);
+ len -= p - buf;
+ buf = p;
if (r->request_line.data == NULL && r->request_start) {
for (p = r->request_start; p < r->header_in->last; p++) {
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_request_filename(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_server_name(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_request_method(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_remote_user(ngx_http_request_t *r,
ngx_http_variable_request_filename, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0 },
- { ngx_string("server_name"), NULL, ngx_http_variable_request,
- offsetof(ngx_http_request_t, server_name), 0, 0 },
+ { ngx_string("server_name"), NULL, ngx_http_variable_server_name, 0, 0, 0 },
{ ngx_string("request_method"), NULL,
ngx_http_variable_request_method, 0, 0, 0 },
ngx_http_variable_host(ngx_http_request_t *r, ngx_http_variable_value_t *v,
uintptr_t data)
{
+ ngx_http_core_srv_conf_t *cscf;
+
if (r->host_start == NULL) {
if (r->headers_in.host) {
v->data = r->headers_in.host->value.data;
} else {
- v->len = r->server_name.len;
- v->data = r->server_name.data;
+ cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+
+ v->len = cscf->server_name.len;
+ v->data = cscf->server_name.data;
}
} else if (r->host_end) {
}
+static ngx_int_t
+ngx_http_variable_server_name(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ ngx_http_core_srv_conf_t *cscf;
+
+ cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
+
+ v->len = cscf->server_name.len;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = cscf->server_name.data;
+
+ return NGX_OK;
+}
+
+
static ngx_int_t
ngx_http_variable_request_method(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)