aboutsummaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/ngx_http_proxy_module.c2
-rw-r--r--src/http/ngx_http_core_module.c23
-rw-r--r--src/http/ngx_http_request.c2
3 files changed, 17 insertions, 10 deletions
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index f63e28872..c85f587f6 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -1255,7 +1255,7 @@ ngx_http_proxy_rewrite_redirect(ngx_http_request_t *r, ngx_table_elt_t *h,
}
for (i = 0; i < plcf->redirects->nelts; i++) {
- rc = pr->handler(r, h, prefix, pr);
+ rc = pr[i].handler(r, h, prefix, &pr[i]);
if (rc != NGX_DECLINED) {
return rc;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index a73448b99..2784921f2 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1880,24 +1880,29 @@ ngx_http_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ls->conf.sndbuf = -1;
}
- if (conf->server_names.nelts == 0) {
- sn = ngx_array_push(&conf->server_names);
- if (sn == NULL) {
+ if (conf->server_name.data == NULL) {
+ conf->server_name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
+ if (conf->server_name.data == NULL) {
return NGX_CONF_ERROR;
}
- sn->name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
- if (sn->name.data == NULL) {
+ if (gethostname((char *) conf->server_name.data, NGX_MAXHOSTNAMELEN)
+ == -1)
+ {
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
+ "gethostname() failed");
return NGX_CONF_ERROR;
}
- if (gethostname((char *) sn->name.data, NGX_MAXHOSTNAMELEN) == -1) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
- "gethostname() failed");
+ conf->server_name.len = ngx_strlen(conf->server_name.data);
+
+ sn = ngx_array_push(&conf->server_names);
+ if (sn == NULL) {
return NGX_CONF_ERROR;
}
- sn->name.len = ngx_strlen(sn->name.data);
+ sn->name.len = conf->server_name.len;
+ sn->name.data = conf->server_name.data;
sn->core_srv_conf = conf;
}
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 7fddde087..9ef5a8014 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1518,6 +1518,8 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->post_action.data) {
+ r->http_version = NGX_HTTP_VERSION_9;
+ r->header_only = 1;
ngx_http_internal_redirect(r, &clcf->post_action, NULL);
return;
}