From c8b859e373089d3f347efb806c9926823de41bf6 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Fri, 4 Jul 2025 16:38:25 +0100 Subject: 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 --- src/nxt_php_sapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nxt_php_sapi.c') 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); -- cgit