• Web server: absolute-form request lines keep http://host in virtual_pa

    From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Sat Nov 21 12:49:34 2026
    open https://gitlab.synchro.net/main/sbbs/-/work_items/1382

    For a request line in absolute form (`GET http://host/path HTTP/1.1`, RFC 9112 §3.2.2, which servers must accept), `parse_request()` in `src/sbbs3/websrvr.cpp` strips the scheme and authority only from `session->req.physical_path` (and takes `host`/`vhost` from it). `session->req.virtual_path`, `request_line` and `orig_request_line` keep the `http://host` prefix, and everything built from them inherits it:

    - **CGI/FastCGI environment.** These are the parameters sent to a FastCGI backend for the same file, captured with a stub FastCGI listener:

    | | origin form `GET /dir/t.php` | absolute form `GET http://wiki.synchro.net/dir/t.php` |
    |---|---|---|
    | `SCRIPT_NAME` | `/dir/t.php` | `http://wiki.synchro.net/dir/t.php` |
    | `REQUEST_URI` | `/dir/t.php` | `http://wiki.synchro.net/dir/t.php` |
    | `SCRIPT_FILENAME` | `/var/www/html/wiki.synchro.net/dir/t.php` | same |

    With `GET http://wiki.synchro.net/index.php`, php-fpm answers "Primary script unknown" / `File not found.` where the origin-form request works.
    - **webctrl.ini hooks.** `http_request.request_string` and `virtual_path` carry the prefix, so `Rewrite` rules anchored on `/` don't match. Rewrite rules on wiki.synchro.net (DokuWiki's `doku_rewrite.js`) skip these requests, and they fall through to `index.php` instead of `doku.php`.
    - Presumably anything else that reads `virtual_path` (SSJS `http_request.virtual_path`, access requirements matched by path, the error pages' path) sees the absolute URI as well. Not checked individually.

    Crawlers use this form heavily: on 2026-11-21, 43% of one scraper's 159K wiki requests were absolute-form, against 2-3% of other traffic. Each one got a 68-70 byte response and a hung connection (see the FastCGI response issue filed alongside this one).

    ## Suggested fix

    Normalize once, right after the request line is read: if the request-target starts with `http://` or `https://`, set `host`/`vhost` from the authority and rewrite the target to origin form (path plus query) **before** `virtual_path`, `request_line` and `orig_request_line` are populated. Then everything downstream sees the same thing it would for the origin-form request. `REQUEST_URI` arguably should keep the original target (Apache passes the absolute form through as-is), but `SCRIPT_NAME` must be a path.

    — *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Sat Nov 21 13:59:02 2026
    https://gitlab.synchro.net/main/sbbs/-/work_items/1382#note_11160

    Fixed in 8922f648a7 (size-14-pond, 2026-11-21): an absolute-form request target is reduced to origin-form before `virtual_path`, `request_line` and `orig_request_line` are set, so CGI/FastCGI `SCRIPT_NAME`/`REQUEST_URI` and webctrl.ini scripts see `/path?query`. The host still comes from the request line, ahead of any Host header.

    — *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)