summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/nxt_application.h1
-rw-r--r--src/nxt_php_sapi.c2
-rw-r--r--src/nxt_python_wsgi.c1
-rw-r--r--src/nxt_router.c7
4 files changed, 11 insertions, 0 deletions
diff --git a/src/nxt_application.h b/src/nxt_application.h
index 7747883b..5998e3e9 100644
--- a/src/nxt_application.h
+++ b/src/nxt_application.h
@@ -108,6 +108,7 @@ typedef struct {
nxt_app_request_body_t body;
nxt_str_t remote;
+ nxt_str_t local;
} nxt_app_request_t;
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index 83d5e989..08b8ba01 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -320,6 +320,7 @@ nxt_php_read_request(nxt_task_t *task, nxt_app_rmsg_t *rmsg,
NXT_READ(&h->version);
NXT_READ(&ctx->r.remote);
+ NXT_READ(&ctx->r.local);
NXT_READ(&h->host);
NXT_READ(&h->cookie);
@@ -718,6 +719,7 @@ nxt_php_register_variables(zval *track_vars_array TSRMLS_DC)
NXT_PHP_SET("SERVER_PORT", server_port);
NXT_PHP_SET("REMOTE_ADDR", ctx->r.remote);
+ NXT_PHP_SET("SERVER_ADDR", ctx->r.local);
while (nxt_app_msg_read_str(task, ctx->rmsg, &n) == NXT_OK) {
if (nxt_slow_path(n.length == 0)) {
diff --git a/src/nxt_python_wsgi.c b/src/nxt_python_wsgi.c
index 6c188066..c29aa426 100644
--- a/src/nxt_python_wsgi.c
+++ b/src/nxt_python_wsgi.c
@@ -666,6 +666,7 @@ nxt_python_get_environ(nxt_task_t *task, nxt_app_rmsg_t *rmsg,
NXT_READ("SERVER_PROTOCOL");
NXT_READ("REMOTE_ADDR");
+ NXT_READ("SERVER_ADDR");
RC(nxt_app_msg_read_str(task, rmsg, &host));
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 6cadb816..3faca2c2 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -2431,6 +2431,7 @@ nxt_router_conn_http_header_parse(nxt_task_t *task, void *obj, void *data)
nxt_int_t ret;
nxt_buf_t *buf;
nxt_conn_t *c;
+ nxt_sockaddr_t *local;
nxt_app_parse_ctx_t *ap;
nxt_app_request_body_t *b;
nxt_socket_conf_joint_t *joint;
@@ -2461,6 +2462,10 @@ nxt_router_conn_http_header_parse(nxt_task_t *task, void *obj, void *data)
ap->r.remote.start = nxt_sockaddr_address(c->remote);
ap->r.remote.length = c->remote->address_length;
+ local = joint->socket_conf->sockaddr;
+ ap->r.local.start = nxt_sockaddr_address(local);
+ ap->r.local.length = local->address_length;
+
ap->r.header.buf = buf;
}
@@ -2781,6 +2786,7 @@ nxt_python_prepare_msg(nxt_task_t *task, nxt_app_request_t *r,
NXT_WRITE(&h->version);
NXT_WRITE(&r->remote);
+ NXT_WRITE(&r->local);
NXT_WRITE(&h->host);
NXT_WRITE(&h->content_type);
@@ -2864,6 +2870,7 @@ nxt_php_prepare_msg(nxt_task_t *task, nxt_app_request_t *r,
// DOCUMENT_ROOT
NXT_WRITE(&r->remote);
+ NXT_WRITE(&r->local);
NXT_WRITE(&h->host);
NXT_WRITE(&h->cookie);