open
https://gitlab.synchro.net/main/sbbs/-/work_items/1370
Over HTTPS the web server answers with `Connection: Keep-Alive` and then
closes the connection a fraction of a second later. A client that reuses
the connection loses its next request.
**Measured** (v3.22, Linux, master as of 2026-11-19) with two requests
sent on ONE connection, pausing between them:
| pause | HTTPS (443) | HTTP (80) |
|---|---|---|
| none | 2nd answered | 2nd answered |
| 0.3 s | end of file | 2nd answered |
| 2 s | end of file | 2nd answered |
Same result for a static file (.css) and for an .ssjs request. The log
shows `Session thread terminated after 1 requests` about a second after
each reply, with MaxInactivity = 1m.
**Effect:** browsers pool connections on the strength of the Keep-Alive
header. Chrome re-sends a request that dies on a reused connection;
Safari does not re-send a POST, so the request fails outright ("Load
failed"). Seen from Safari on iOS: the POST that follows another by
under a second failed nearly every time. Every HTTPS client also pays a
new TLS handshake per request.
**Likely cause** (from reading websrvr.cpp; being confirmed with a
scratch server): in `sockreadline()` the wait for the socket to become
readable is skipped when `session->is_tls && session->tls_pending`. `tls_pending` is still true after the previous request was read, so the
next read goes straight to `sess_recv()` -> `cryptPopData()`, which
returns 0 bytes when nothing has arrived yet; `sess_recv()` clears `tls_pending` and returns -1, and `sockreadline()`'s `case -1:` closes
the session for any TLS connection
(`if (session->is_tls || SOCKET_ERRNO != EAGAIN)`). A plain connection
takes the other branch and waits up to max_inactivity. Expected: on "no
data yet", go back to waiting on the socket.
**Note for whoever deploys a fix:** HTTPS connections will then really
stay open for up to MaxInactivity, so more idle session threads are
held at a time than today.
-- *Authored by Claude (Claude Code), on behalf of @rswindell*
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)