summaryrefslogtreecommitdiffhomepage
path: root/src/python/nxt_python_wsgi.c
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2025-07-04 16:38:25 +0100
committerAndrew Clayton <a.clayton@nginx.com>2025-07-25 04:49:45 +0100
commitc8b859e373089d3f347efb806c9926823de41bf6 (patch)
tree96f080acede9233e2b13e657ac371f1867fd8a90 /src/python/nxt_python_wsgi.c
parenta9071e11602ec73b96302c852709c16c9d55996d (diff)
downloadunit-c8b859e373089d3f347efb806c9926823de41bf6.tar.gz
unit-c8b859e373089d3f347efb806c9926823de41bf6.tar.bz2
Set SERVER_PORT appropriately
The Perl, PHP, Python, Ruby & Java language modules all hard code SERVER_PORT to "80". Adjust them to bring them in line with the wasm language module which uses r->local_port (I.e. the port unit accepted the connection on). Closes: https://github.com/nginx/unit/issues/761 Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src/python/nxt_python_wsgi.c')
-rw-r--r--src/python/nxt_python_wsgi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/python/nxt_python_wsgi.c b/src/python/nxt_python_wsgi.c
index ec9fefca..6bbf9e39 100644
--- a/src/python/nxt_python_wsgi.c
+++ b/src/python/nxt_python_wsgi.c
@@ -131,7 +131,6 @@ static PyTypeObject nxt_py_input_type = {
static PyObject *nxt_py_environ_ptyp;
-static PyObject *nxt_py_80_str;
static PyObject *nxt_py_close_str;
static PyObject *nxt_py_content_length_str;
static PyObject *nxt_py_content_type_str;
@@ -151,7 +150,6 @@ static PyObject *nxt_py_wsgi_input_str;
static PyObject *nxt_py_wsgi_uri_scheme_str;
static nxt_python_string_t nxt_python_strings[] = {
- { nxt_string("80"), &nxt_py_80_str },
{ nxt_string("close"), &nxt_py_close_str },
{ nxt_string("CONTENT_LENGTH"), &nxt_py_content_length_str },
{ nxt_string("CONTENT_TYPE"), &nxt_py_content_type_str },
@@ -638,6 +636,8 @@ nxt_python_get_environ(nxt_python_ctx_t *pctx,
r->remote_length));
RC(nxt_python_add_sptr(pctx, nxt_py_server_addr_str, &r->local_addr,
r->local_addr_length));
+ RC(nxt_python_add_sptr(pctx, nxt_py_server_port_str, &r->local_port,
+ r->local_port_length));
if (r->tls) {
RC(nxt_python_add_obj(pctx, nxt_py_wsgi_uri_scheme_str,
@@ -652,7 +652,6 @@ nxt_python_get_environ(nxt_python_ctx_t *pctx,
RC(nxt_python_add_sptr(pctx, nxt_py_server_name_str, &r->server_name,
r->server_name_length));
- RC(nxt_python_add_obj(pctx, nxt_py_server_port_str, nxt_py_80_str));
nxt_unit_request_group_dup_fields(pctx->req);