Skip to content

Development Updates#48

Merged
DannyArends merged 46 commits intomasterfrom
development
Mar 22, 2026
Merged

Development Updates#48
DannyArends merged 46 commits intomasterfrom
development

Conversation

@DannyArends
Copy link
Copy Markdown
Owner

Bug Fixes

  • Double ? in canonical redirect URLs (router.d)
  • Upload size limit inconsistency - multipart now uses max_upload_size, not max_request_size (post.d)
  • CGI response header pollution on fallback - server now owns authoritative headers via single emit loop (response.d)
  • logConnection called twice for keepalive connections - fixed with starttime guard (client.d)
  • Data races on completed, modified, process.terminated in CGI process thread (process.d)
  • Double ? bug in query string for canonical redirects (router.d)
  • Multi-colon header values silently dropped in CGI header parsing (cgi.d, response.d)
  • IPv6 host/port parsing broken in Host header (request.d)

Security / Robustness

  • JSON POST no longer falls through to parseXform (post.d)
  • ready() return type corrected from long to bool across Payload interface
  • All payload && truthiness checks replaced with payload !is null (client.d, interfaces.d, response.d, post.d)

Shutdown & Cleanup

  • Windows Ctrl+C handler via SetConsoleCtrlHandler (signals.d)
  • Linux SIGINT/SIGTERM unified into registerExitHandler() (signals.d)
  • runRequest exits immediately on shutdownSignal - no stale unittest runs after Ctrl+C (router.d)
  • .in files now cleaned up via scope(exit) chain: client → response.kill() → process scope(exit) (process.d, response.d, client.d)
  • safeClose/safeRemove nothrow helpers for guaranteed cleanup (process.d)

Streaming Multipart Uploads

  • New MultipartParser state machine in multipart.d - streams file data directly to disk as chunks arrive
  • inbuffer never accumulates upload body - receiveChunk() drains buffered bytes then reads socket directly
  • trimToHeader() called once on first chunk, header preserved in inbuffer throughout
  • 10 unit tests covering: text fields, file uploads, mixed, cross-chunk boundaries, binary content, empty files, multiple fields, boundary-like values, large files, header split across chunks

Dead Code & Refactoring

  • Removed dead request.maxtime field, get() method on Request, blocking stored field
  • havepost moved from Response to Request.postParsed
  • Domain.entries/buffered converted from stored fields to computed properties
  • PostItem/PostType moved from post.d to request.d (semantic home)
  • Serving free functions (notFound, forbidden, serveCGI etc.) moved to router.d
  • FilePayload/FileStream moved from files.d to payload.d
  • File system utilities (isCGI, safePath, resolve etc.) moved to filesystem.d
  • HTTP parsing utilities (endofheader, bodystart, fullheader, sISelect) consolidated
  • All unused imports removed
  • Cyclic module constructor dependency resolved (webconfig ↔ ssl via filesystem ↔ files)
  • api/danode.d setPOST() fixed for values containing = characters

Test Coverage

  • Unit tests added/expanded across: multipart.d, client.d, request.d, files.d, post.d
  • ~144 unittest lines added (~30% of total additions)

@DannyArends DannyArends merged commit f8b5e82 into master Mar 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant