Commit Graph
43 Commits
Author SHA1 Message Date
Brad ArantandClaude Sonnet 5 51133e0c76 Wire CGI form data through the new Parser-based CGIFormData
Global now owns a long-lived StreamReader (cgiReader) that CGIFormData
(a Parser) holds a reference to - declared before cgiData so it's
constructed first and destroyed last. __jet.cpp's POST handling
constructs CGIFormData against it and feeds the request body off stdin
in 4KB chunks, driving doParse() after each feed rather than blocking to
read the whole body up front - the same feed()/doParse() pattern a
socket-fed StreamReader would use, keeping memory bounded for large
multipart uploads.

Also fixes two real, pre-existing bugs surfaced while getting an actual
end-to-end CGI request working through jet-2.0 (not just compiling):

- Tag::Tag's opening-tag parser was gated on "parent && in.ifNext(\"<\")",
  but jet-2.0.cpp's main() constructs the top-level __jet with
  parent=NULL - meaning the outer <jet ...> tag's own attributes
  (cgi="yes" and everything else) were never actually parsed at all, just
  echoed as literal passthrough content. parent=NULL is used at exactly
  one call site in the whole codebase, so dropping the "parent &&"
  requirement only changes behavior for that one top-level case - every
  nested tag construction already passes a real parent.

- __jet.cpp's boundary-extraction code calls contentType.find("boundary=")
  to locate the multipart boundary parameter, but find() repositions
  contentType's own cursor to the match as a side effect. That same
  cursor-shifted contentType then got passed into CGIFormData's
  constructor, whose startsWith("multipart/form-data")/
  startsWith("application/x-www-form-urlencoded") checks are
  cursor-relative and so silently matched neither, falling through to an
  unrecognized content type that parsed nothing (reported COMPLETE
  immediately, no error, just empty results). Fixed with
  contentType.reset() before the CGIFormData construction.

Verified with a real end-to-end run: jet-2.0 invoked with simulated CGI
environment variables (REQUEST_METHOD=POST, CONTENT_TYPE with a
boundary=, CONTENT_LENGTH) and a genuine multipart/form-data body
(including a file-upload part) piped over stdin, using $[:name] in a
.jet script - correctly returns each field's value and correctly leaves
the skipped upload field empty.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 15:07:30 -07:00
Brad ArantandClaude Sonnet 5 2d9505cd33 Fix jet cgi=yes CGI variable loading and related bugs
- __jet.cpp: the cgi keyword check compared against "true" but the
  documented/intended value is "yes", so <jet cgi="yes" ...> never
  actually turned CGI mode on; fixed. Also replaced the hardcoded
  fake multipart boundary ("xxxx") with real extraction from the
  Content-Type header's boundary= parameter.
- Global.h: default-initialize cgiData to NULL (a GET request with
  cgi="yes" never allocates it, so it was previously left
  dangling); Global.cpp now sets the cookie jar's delimiter to ";"
  to match RFC 6265, since it defaulted to CGIFormattedData's
  &-based form-data delimiter.
- Global.cpp: fix addSession()'s missing throw that let it silently
  continue past a duplicate session id.
- Tag.cpp: fix the CGI-variable lookup branch, which failed to
  compile (cgiData is a pointer; needed to dereference it before
  indexing) and added a null check so a CGI request that never
  populated cgiData (bad Content-Type, or the null-safety gap
  above) throws a clear error instead of crashing; implemented the
  previously-empty session-variable lookup branch; left the
  unreachable duplicate environment-variable branch as-is with a
  comment, since fixing its sigil is a user-facing template-syntax
  decision, not a bug fix.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-22 21:37:51 -07:00
Brad Arant d0f2551e89 Still working out cgi variable stuff. 2025-12-10 16:48:23 -08:00
Brad Arant e6ebb34366 Continued work on cgi interfaces. 2025-12-09 16:40:15 -08:00
Brad Arant ac0865d2da CGI parsing work in progress. 2025-12-08 16:36:14 -08:00
Brad Arant 7e835e5073 Working on CGI session stuff. 2025-12-04 17:05:57 -08:00
brad Arant 280d4b8aa2 Clean up the transparent markers function. 2025-10-20 16:22:22 -07:00
Brad Arant 94c8833f2a Merge branch 'master' of ssh://barant.com/git/JetCore 2025-05-22 09:26:03 -07:00
Brad Arant 0cb8a08a73 New sessionid object. 2025-05-22 09:25:55 -07:00
brad Arant ddf0595fb1 Merge branch 'master' of ssh://barant.com/git/JetCore 2025-05-01 19:02:25 -07:00
brad Arant 0159050b7d changes 2025-05-01 19:02:17 -07:00
Brad Arant fd5069f69f Moving session id out of jet tag. 2025-05-01 15:01:16 -07:00
Brad Arant 078ba7f81c significant work on cookies and cgi formdata variables. 2025-03-18 16:46:39 -07:00
Brad Arant 050b5f2b87 more formdata work. 2025-03-17 16:46:50 -07:00
brad Arant d3cd5f3c9a More session work. 2025-03-17 07:44:36 -07:00
brad Arant 60affa288e Merge branch 'master' of ssh://barant.com/git/JetCore 2025-03-09 14:59:24 -07:00
brad Arant d74093b48a moe testing work. 2025-03-09 14:58:22 -07:00
Brad Arant f150389672 worked on cgi session stuff. 2025-03-06 14:54:54 -08:00
brad Arant 80d31540d9 Some cgi work. 2025-02-10 07:12:31 -08:00
brad Arant adf5449a6f fixed header tag. 2025-02-07 19:29:18 -08:00
brad Arant d34ff928d9 fixed __jet.cpp merge for cgi work. 2025-02-07 16:12:09 -08:00
brad Arant c0f44a3bc5 work on cgi. 2025-02-07 16:10:13 -08:00
Brad Arant 10db0e9c70 created INTEGER function on operand. 2025-02-04 09:28:28 -08:00
Brad Arant ce6b163d5d added some logic for session controls. 2025-01-30 15:54:35 -08:00
Brad Arant c11d5abcd0 Fixed some bugs in include and jet tags for cgi handling. 2025-01-16 15:45:15 -08:00
Brad Arant f1f45af332 some notes on jet tag. 2025-01-15 15:44:53 -08:00
Brad Arant edebae34b1 allow cookie, header and stream only in cgi mode. 2025-01-15 14:51:15 -08:00
barant 5c27df59da work towards a clean compile on migrating set and get variables from Tag. 2025-01-08 10:27:30 -08:00
brad Arant 9622b5cf8c Moved keywords from local variables to keywords map. 2025-01-02 16:43:53 -08:00
brad Arant 6d2da98024 major scope work completed. Works well!!! 2024-11-27 09:47:17 -08:00
Brad Arant ca7aabd73f more sever scoping work. 2024-11-26 16:57:03 -08:00
brad Arant 1c7edf3118 added dump tag. 2024-11-24 14:25:39 -08:00
brad Arant a9ce087939 urlencoded forms data is now workng as well. 2024-11-24 13:21:44 -08:00
brad Arant c21dea1411 some cgi variable work. 2024-11-23 19:25:14 -08:00
Brad Arant b0453fe0cb worked on error output just a little. 2024-11-18 16:59:32 -08:00
Brad Arant 39f5936787 Work on the CGI handling. 2024-11-11 15:59:42 -08:00
brad Arant d7936de84f Laid ground work for resolveKeyword method on Tag and to not resolve automatically. 2024-11-10 13:07:53 -08:00
Brad Arant ad48c530a0 Added parent tag pointer throughout call hierarchy.Cleaned up output hierarchy parameter names. 2024-10-30 15:23:13 -07:00
Brad Arant 4972799e7a Fucked up variable handling trying to improve things with a modifier. 2024-10-16 16:58:33 -07:00
Brad Arant e655173a8f Worked on exception reporting. 2024-09-25 17:15:03 -07:00
brad Arant dd5768ea66 Fixed for tag. 2024-07-08 18:32:56 -07:00
Brad Arant bb7be37fd6 Making it work but it doesnt 2024-02-16 11:13:10 -08:00
Brad Arant fce97e04ff Initial repository commit. 2022-05-19 11:43:15 -07:00