Commit Graph
200 Commits
Author SHA1 Message Date
Brad ArantandClaude Sonnet 5 6f2f3d7339 Fix testpost.jet: cgi="true" doesn't match __jet.cpp's cgi=="yes" check
$[^session] (a cookie lookup, global.cookies.data[name]) was always
empty because __jet.cpp's cgi keyword check compares against "yes" (a
deliberate choice from an earlier session, not the codebase-wide
true/false convention used by filterblanklines/trimlines/eval etc.) -
testpost.jet had cgi="true", a stale mismatch that predates that
decision, so the entire cgi block (including reading HTTP_COOKIE into
global.cookies) never ran at all. Fixed the test fixture to say
cgi="yes" to match.

Verified live via tests/posttest.sh against the current build:
$[^session] now correctly prints 18fd56a83f (posttest.sh's simulated
HTTP_COOKIE session id), and dump.txt's *** COOKIES *** section shows
session=[18fd56a83f] instead of empty. dump.txt committed with this
fresh, correct output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-23 17:44:45 -07:00
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 3bd9ea124f Continued work on cgi interfaces. 2025-12-09 12:29:39 -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 8b38617b00 Setup font capability on documentation. 2025-12-03 16:14:25 -08:00
Brad Arant 50a29a4238 Added stub for DATEDIFF function. 2025-12-03 14:55:26 -08:00
Brad Arant db59e9e87c fixed output of numeric output from expr(). 2025-12-02 15:56:31 -08:00
Brad Arant 3f14b28435 New test for expression priorities. 2025-11-25 13:58:23 -08:00
Brad Arant a91d78f524 Fixed * and / operators to prioritize over + and -. 2025-11-25 13:16:26 -08:00
Brad Arant 61216a2296 Some docuemtation updats. 2025-11-24 13:50:27 -08:00
Brad Arant 63916cc32a Added FLOOR and CEIL function in operand. 2025-11-24 13:19:31 -08:00
Brad Arant 5e0523619d Added new tests for MIN and MAX. 2025-11-24 12:19:25 -08:00
Brad Arant 3314a410e0 Added MIN and MAX functions for operand. 2025-11-24 12:15:56 -08:00
Brad Arant c21f27f14d add some items to gitignore for document workspace. 2025-11-24 09:45:45 -08:00
Brad Arant 4e47d6aaf7 add some items to gitignore for document workspace. 2025-11-24 09:42:15 -08:00
barant e6bee9b67b Merge pull request 'addfunctions' (#1) from addfunctions into master
Reviewed-on: #1
2025-11-22 03:43:37 +00:00
brad Arant 6e25db1e44 Doc updates. 2025-11-21 19:15:48 -08:00
brad Arant c4f0fab8c7 Added a bunch of functions. 2025-11-08 20:04:45 -08:00
brad Arant 96302e1d27 Added ability for call tag to use container as input stream. 2025-11-07 19:35:07 -08:00
brad Arant bdbae9e397 Added CGI stuff and unixtime function. 2025-11-07 10:22:40 -08:00
brad Arant 078a73664c Added CGI stuff and unixtime function. 2025-11-07 10:22:20 -08:00
brad Arant 280d4b8aa2 Clean up the transparent markers function. 2025-10-20 16:22:22 -07:00
brad Arant 7b6342b8d7 Fixed not a number issue with expression. 2025-10-20 10:56:30 -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 2f30b3f8c4 Broke out session object. 2025-05-06 07:33:04 -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 24035c9d28 Update to documentation. 2025-04-30 16:25:39 -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 167ee75658 add upper and lower to operand functions. 2025-02-13 10:27:44 -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 6e097d8433 some small testvar updates. 2025-02-06 16:06:41 -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 92d34ee689 updated TOTO. 2025-01-16 16:22:47 -08:00
Brad Arant c11d5abcd0 Fixed some bugs in include and jet tags for cgi handling. 2025-01-16 15:45:15 -08:00