summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_php_sapi.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/nxt_php_sapi.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/nxt_php_sapi.c')
-rw-r--r--src/nxt_php_sapi.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index da667b66..c20e074c 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -1500,7 +1500,8 @@ nxt_php_register_variables(zval *track_vars_array TSRMLS_DC)
nxt_php_set_sptr(req, "SERVER_NAME", &r->server_name, r->server_name_length,
track_vars_array TSRMLS_CC);
- nxt_php_set_cstr(req, "SERVER_PORT", "80", 2, track_vars_array TSRMLS_CC);
+ nxt_php_set_sptr(req, "SERVER_PORT", &r->local_port, r->local_port_length,
+ track_vars_array TSRMLS_CC);
if (r->tls) {
nxt_php_set_cstr(req, "HTTPS", "on", 2, track_vars_array TSRMLS_CC);