SERVER_PORT cgi env value is dubious
(1) By anonymous on 2025-01-09 17:48:04 [source]
Putting the following into a file and marking it executable:
#!/bin/bash
echo "Content-type: text/html"
echo ""
echo '<html>'
echo '<head>'
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'
echo '<title>CGI Env Values Test</title>'
echo '</head>'
echo '<body>'
echo '<h1>Checking environment values</h1>'
echo 'Checking SERVER_PORT (running on port 443 under https:)<br>'
echo $SERVER_PORT
echo '</body>'
echo '</html>'
exit 0
And then viewing the page served by a port 443 althttpd server (under https:) gives the following output:
Checking environment values
Checking SERVER_PORT (running on port 443 under https:)
80
This is surprising, I would have expected 443 to be returned.
Not important, but not correct either.
Other environment values seem to be correct.
This is freshly compiled from current tip of trunk.
(2) By drh on 2025-01-09 21:19:11 in reply to 1 [link] [source]
Please try check-in 186fc574abf4df34 and let me know if that fixes your problem.
(3) By anonymous on 2025-01-10 08:40:02 in reply to 2 [link] [source]
Success, thank you.
Correct port 443 reported when using this check-in (and also port 456, tested just for completeness, is reported correctly).