Mercurial > hg
comparison tests/test-serve.t @ 45034:b1a1702262c9 stable
py3: fix crash when server address is 0.0.0.0 (issue6362)
`socket.getfqdn()` assumes that the name is passed as `str` on Python 3 and
always returns `str` in this case. Mercurial passed `bytes` (but still expected
a `str` result), which worked by chance in many cases, except for e.g.
b'0.0.0.0', which was returned unchanged, breaking later code.
Instead of calling `socket.getfqdn()`, we can also use `self.server_name` from
the base `HTTPServer` class, which already stores the FQDN of the locally-bound
socket name (see `BaseHTTPServer.py` in the Python 2 stdlib and
`http/server.py` in the Python 3 stdlib).
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Fri, 03 Jul 2020 23:25:19 +0200 |
parents | 5abc47d4ca6b |
children | 9a062913bab6 |
comparison
equal
deleted
inserted
replaced
45031:383005aa9cdc | 45034:b1a1702262c9 |
---|---|
97 | 97 |
98 $ cat access.log errors.log | 98 $ cat access.log errors.log |
99 $LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob) | 99 $LOCALIP - - [$LOGDATE$] "GET /some/dir7?cmd=capabilities HTTP/1.1" 404 - (glob) |
100 $LOCALIP - - [$LOGDATE$] "GET /some?cmd=capabilities HTTP/1.1" 404 - (glob) | 100 $LOCALIP - - [$LOGDATE$] "GET /some?cmd=capabilities HTTP/1.1" 404 - (glob) |
101 | 101 |
102 $ "$PYTHON" $RUNTESTDIR/killdaemons.py $DAEMON_PIDS | |
103 | |
104 issue6362: Previously, this crashed on Python 3 | |
105 | |
106 $ hg serve -a 0.0.0.0 -d | |
107 listening at http://*:$HGPORT1/ (bound to *:$HGPORT1) (glob) | |
108 | |
102 $ cd .. | 109 $ cd .. |