https://gitlab.synchro.net/main/sbbs/-/commit/8ca45d70dd9a9e39e33e4fc3
Modified Files:
docs/v322_new.md src/sbbs3/websrvr.cpp
Log Message:
Web Server: send a failed script's error page as the static file it is
When a server-side script or CGI program failed, send_error() sent the
500 page with req.dynamic still set from the request, so
send_headers() built the reply as dynamic content:
- no Content-Type (or Last-Modified), even for the stock 500.html;
- for CGI, no Content-Length either;
- any headers queued in req.dynamic_heads were sent with the error.
A CGI program that sent header lines and then stalled past
MaxCgiInactivity before ending its header block had those lines
(Set-Cookie: and its Content-Type: text/plain included) sent with
the HTML error page.
send_error() now marks the request static around the send_headers()
call for the error page, when no headers have been sent yet, and
restores it afterwards so close_request() still sees the request's
own type (JS garbage collection, chunked-transfer termination). The
error reply now gets the same headers as any static file: Content-Type, Last-Modified, an exact Content-Length when the page exists, and the
built-in page's handling when it doesn't. Allow and Accept-Ranges
follow, as "GET, HEAD, OPTIONS" and "bytes".
Tested against a loopback web server, before and after: an SSJS
script that throws, and CGI programs that stall before any output
and after sending Set-Cookie and Content-Type, now get text/html and Content-Length: 166 with the stock 500.html (text/html and no length
with no page), and no Set-Cookie. Successful SSJS and CGI replies,
static files, and the 404 served by 404.ssjs are unchanged.
Fixes #1447
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net