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
2024-12-02 15:46:49 -08:00
2025-12-09 16:40:15 -08:00
2025-05-06 07:33:04 -07:00
2025-05-06 07:33:04 -07:00
2025-01-09 07:49:11 -08:00
2025-02-07 19:29:18 -08:00
2025-02-07 19:29:18 -08:00
2025-12-09 12:29:39 -08:00
2025-01-09 08:02:38 -08:00
2025-01-09 08:02:38 -08:00
2025-02-07 16:10:13 -08:00
2025-11-21 19:15:48 -08:00
2025-11-21 19:15:48 -08:00
2025-12-03 14:55:26 -08:00
2025-12-04 17:05:57 -08:00
2025-05-06 07:33:04 -07:00
2025-11-21 19:15:48 -08:00
2025-11-07 10:22:20 -08:00
2025-11-21 19:15:48 -08:00
2025-11-21 19:15:48 -08:00
2025-11-21 19:15:48 -08:00
2025-11-21 19:15:48 -08:00
2025-11-21 19:15:48 -08:00
2025-11-08 20:04:45 -08:00
S
Description
JET 2.0 core library.
40 MiB
0 Stars 0 Watchers 0 Forks
Languages
HTML 50.2%
TeX 18.7%
C++ 15%
JavaScript 7.5%
CSS 4.4%
Other 4.2%