start: name the requested --http-host/--http-port in the opening line

The first line was hardcoded to http://127.0.0.1:8080 while the flags
were passed through, so ./start.sh --http-host 10.0.28.161 printed
127.0.0.1 although the server bound 10.0.28.161 (its own listening banner
named it).  Both start scripts now parse --http-host/--http-port (space
and = forms, the last value wins like argparse) and echo the effective
address; start.bat parses with shift (%* is unaffected, so the server
still receives every argument).

Bump 3.38.2 (server, pyproject, PWA header, sw simple-v483) and add the
CHANGELOG entry.

Tests: tests/test_pcsc_startup.py pins the parsing/echo (2 new).
1090 Python + 1075 frontend.
This commit is contained in:
2026-10-25 03:25:22 +03:00
parent 393b1098ce
commit 62c5b4e1a9
8 changed files with 81 additions and 9 deletions
+13
View File
@@ -9,6 +9,19 @@ every change carries a descriptive commit message.
## [Unreleased]
## [3.38.2] — 2026-10-25
### Fixed
- **The start scripts name the address they were asked to bind.** The opening
`Starting pysim-simple-server on http://127.0.0.1:8080` line was hardcoded
while `--http-host`/`--http-port` were passed through to the server:
`./start.sh --http-host 10.0.28.161` bound correctly (the server's own
`listening on` banner named the address), but the first line still said
127.0.0.1. `start.sh` and `start.bat` now parse both flags (space and `=`
forms, the last value wins like argparse) and echo the effective address;
the defaults are unchanged.
## [3.38.1] — 2026-10-25
### Performance
+1 -1
View File
@@ -1959,7 +1959,7 @@
// ===== Version =====
// Single source of truth for the PWA version: shown in the header and used
// by the server version check in pysimConnect().
const SIMPLE_VERSION = '3.38.1';
const SIMPLE_VERSION = '3.38.2';
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
// ===== view history (the browser Back/Forward buttons) =====
+1 -1
View File
@@ -1,4 +1,4 @@
const CACHE = 'simple-v482';
const CACHE = 'simple-v483';
const URLS = [
'index.html',
'help.html',
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "pysim-simple-server"
version = "3.38.1"
version = "3.38.2"
description = "HTTP REST server wrapping pysim for the SIMple PWA"
license = { text = "GPL-2.0-or-later" }
requires-python = ">=3.9"
+1 -1
View File
@@ -37,7 +37,7 @@ from osmocom.tlv import BER_TLV_IE
from osmocom.utils import rpad
VERSION = '3.38.1'
VERSION = '3.38.2'
MAX_ENVELOPE_SEGMENTS = 5 # max SMS segments for outgoing C-APDU in ENVELOPE
+29 -3
View File
@@ -12,15 +12,41 @@ set VENV_DIR=%~dp0.venv
set LOG=%~dp0simple_lastrun.log
set PYTHONUNBUFFERED=1
REM The address the opening line names (v3.38.2). The server parses the same
REM flags; this mirrors its last-one-wins rule for the echo. %* is not
REM affected by SHIFT, so the server still receives every argument.
set "HTTP_HOST=127.0.0.1"
set "HTTP_PORT=8080"
:parse_http_args
if "%~1"=="" goto http_args_done
if /i "%~1"=="--http-host" (
set "HTTP_HOST=%~2"
shift
shift
goto parse_http_args
)
if /i "%~1"=="--http-port" (
set "HTTP_PORT=%~2"
shift
shift
goto parse_http_args
)
set "ARG=%~1"
if /i "%ARG:~0,12%"=="--http-host=" set "HTTP_HOST=%ARG:~12%"
if /i "%ARG:~0,12%"=="--http-port=" set "HTTP_PORT=%ARG:~12%"
shift
goto parse_http_args
:http_args_done
if exist "%VENV_DIR%\Scripts\pysim-simple-server.exe" (
echo Starting pysim-simple-server from venv on http://127.0.0.1:8080
echo Starting pysim-simple-server from venv on http://%HTTP_HOST%:%HTTP_PORT%
echo Log: simple_lastrun.log (overwritten on each start^). Press Ctrl+C to stop.
"%VENV_DIR%\Scripts\pysim-simple-server.exe" --http-port 8080 -p 0 %* 2>&1 | powershell -NoProfile -Command "$input | Tee-Object -FilePath '%LOG%'"
goto :eof
)
if exist "%~dp0pysim_simple_server\__main__.py" (
echo Starting pysim-simple-server from source on http://127.0.0.1:8080
echo Starting pysim-simple-server from source on http://%HTTP_HOST%:%HTTP_PORT%
echo Log: simple_lastrun.log (overwritten on each start^). Press Ctrl+C to stop.
python -m pysim_simple_server --http-port 8080 -p 0 %* 2>&1 | powershell -NoProfile -Command "$input | Tee-Object -FilePath '%LOG%'"
goto :eof
@@ -28,7 +54,7 @@ if exist "%~dp0pysim_simple_server\__main__.py" (
where pysim-simple-server >nul 2>&1
if %errorlevel% equ 0 (
echo Starting pysim-simple-server on http://127.0.0.1:8080
echo Starting pysim-simple-server on http://%HTTP_HOST%:%HTTP_PORT%
echo Log: simple_lastrun.log (overwritten on each start^). Press Ctrl+C to stop.
pysim-simple-server --http-port 8080 -p 0 %* 2>&1 | powershell -NoProfile -Command "$input | Tee-Object -FilePath '%LOG%'"
goto :eof
+20 -2
View File
@@ -10,6 +10,24 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VENV_DIR="$SCRIPT_DIR/.venv"
# The address the opening line names (v3.38.2). The server parses the same
# flags; start.sh passes its own --http-port 8080 before "$@", so a later user
# value wins (argparse keeps the last one) - mirror that here.
HTTP_HOST=127.0.0.1
HTTP_PORT=8080
PREV_ARG=""
for arg in "$@"; do
case "$PREV_ARG" in
--http-host) HTTP_HOST="$arg" ;;
--http-port) HTTP_PORT="$arg" ;;
esac
case "$arg" in
--http-host=*) HTTP_HOST="${arg#*=}" ;;
--http-port=*) HTTP_PORT="${arg#*=}" ;;
esac
PREV_ARG="$arg"
done
# Console + log file. The log contains card keys and request payloads (test
# cards) - it is gitignored and must not be committed.
LOG_FILE="$SCRIPT_DIR/simple_lastrun.log"
@@ -73,7 +91,7 @@ if [ -f "$VENV_DIR/bin/pysim-simple-server" ]; then
elif command -v pysim-simple-server &> /dev/null; then
SERVER="pysim-simple-server"
elif [ -f "$SCRIPT_DIR/pysim_simple_server/__main__.py" ]; then
echo "Starting pysim-simple-server from source on http://127.0.0.1:8080"
echo "Starting pysim-simple-server from source on http://$HTTP_HOST:$HTTP_PORT"
echo "Log: simple_lastrun.log (overwritten on each start)."
cd "$SCRIPT_DIR" && python3 -m pysim_simple_server --http-port 8080 $READER_ARGS "$@"
exit $?
@@ -84,7 +102,7 @@ else
exit 1
fi
echo "Starting pysim-simple-server on http://127.0.0.1:8080"
echo "Starting pysim-simple-server on http://$HTTP_HOST:$HTTP_PORT"
echo "Log: simple_lastrun.log (overwritten on each start)."
echo "Press Ctrl+C to stop."
echo "Extra arguments are passed to the server (e.g. ./start.sh --gsmtap)."
+15
View File
@@ -150,6 +150,21 @@ class SourcePins(unittest.TestCase):
# the old "is pcscd running" heuristic is gone
self.assertNotIn('pgrep -x pcscd', src)
def test_the_start_message_names_the_requested_address(self):
src = (Path(m.__file__).parent.parent / 'start.sh').read_text()
self.assertIn('--http-host=*) HTTP_HOST="${arg#*=}"', src)
self.assertIn('--http-port=*) HTTP_PORT="${arg#*=}"', src)
self.assertIn('http://$HTTP_HOST:$HTTP_PORT', src)
# the old hardcoded address is gone (the defaults are named separately)
self.assertNotIn('http://127.0.0.1:8080', src)
def test_the_start_bat_message_names_the_requested_address(self):
src = (Path(m.__file__).parent.parent / 'start.bat').read_text()
self.assertIn('--http-host=', src)
self.assertIn('--http-port=', src)
self.assertIn('%HTTP_HOST%:%HTTP_PORT%', src)
self.assertNotIn('http://127.0.0.1:8080', src)
if __name__ == '__main__':
unittest.main()