summaryrefslogtreecommitdiff
path: root/ycurses/src/examples/example1.cpp
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-07 17:25:21 +0300
committerPaul Buetow <paul@buetow.org>2026-07-07 17:25:21 +0300
commitdeacb3f85936beac6c8d60b9ba92ea64e518ca53 (patch)
tree7022388937e221195ca2d25bd5fa51d1d3e6da6b /ycurses/src/examples/example1.cpp
parentde984d11e8e54c4009225488cef1ad89ddd24f46 (diff)
fix(sock): apply chat colors by fixing POST body parsing
The color picker (colors.html) saved fine in the UI but the chosen colors were never applied to chat messages. End-to-end testing traced this to two bugs in sock.cpp's HTTP parameter parsing, both affecting any POSTed chat value containing spaces (notably the "/col col1 col2" command the 'Save colors' button sends via a hidden form): 1. The POST body was never URL-decoded. Browsers encode the body (spaces -> '+', '/' -> %2F), so "/col 0000FF FF0000" arrived as "%2Fcol+0000FF+FF0000" and was never recognized as a command (the leading '/' was hidden behind %2F). The GET path already url_decodes s_query up front; the POST body now gets the same treatment. 2. The last request parameter was truncated at the first space, so even a raw-space body "message=/col 0000FF FF0000" became "message=/col" and the /col command lost its color arguments, falling back to the default colors. This also truncated every multi-word chat message to its first word. The last-param block now takes the full value after '=' (matching the while-loop branch), with the legacy \AND->& escape. To keep GET session lookups working (stream.html / online.html, where tmpid is the last query parameter), the request-line extraction of s_query now uses i_http_pos (not i_http_pos+1) so the space before "HTTP/1.1" is excluded -- otherwise it leaked into the last param as a trailing space (tmpid=...\x20) and broke get_session(). The old first-space truncation happened to mask this; removing it exposed the trailing space, which is now fixed at the source. Verified end-to-end in Docker: /col 0000FF FF0000 (raw and URL-encoded bodies) now sets nick=#0000ff / text=#ff0000, multi-word chat messages are preserved, and GET stream/online/session lookups still work.
Diffstat (limited to 'ycurses/src/examples/example1.cpp')
0 files changed, 0 insertions, 0 deletions