sigil-http / treeREADME.md
sigil-http
HTTP/1.1 client and server library for Sigil.
Provides HTTP/1.1 support for building web applications and APIs. Primary use cases are serving documentation sites and game server APIs.
This package was extracted from the sigil monorepo — the in-tree history under packages/sigil-http/ is preserved here as master.
Usage
(import (sigil http))
;; Client — GET / POST / PUT / DELETE
(let ((response (http-get "https://example.com/")))
(display (http-response-body response)))
(http-post "https://api.example.com/users"
"{\"name\":\"Alice\"}"
'(("Content-Type" . "application/json")))
;; Server
(http-serve
port: 8080
handler: (lambda (request)
(http-response 200 '(("Content-Type" . "text/plain"))
"Hello, world!")))See docs/http.md for the full API reference, including streaming bodies, Server-Sent Events, and low-level request/response manipulation.
Binary uploads
(sigil http client) exports http-fetch-bytes. Its body: argument accepts a string or bytevector; use bytevectors for images and other binary data. The response has status:, an ordered headers: alist, and bytevector body:. Redirects are returned to the caller and transport failures return #f.
(import (sigil http client))
(http-fetch-bytes 'PUT "https://example.com/object"
headers: #{ content-type: "application/octet-stream" }
body: image-bytes timeout: 30)Run node test/integration/run-upload-tests.mjs (Node 18+) for the full Sigil suite plus an ephemeral loopback server exercising empty and 2 MB binary bodies.
Dependencies
sigil-stdlib,sigil-socket,sigil-tls— pinned viafrom-gitagainst the sigil monorepo (^0.13.1). Resolved automatically bysigil deps install.
Build
sigil deps install
sigil build
sigil testDevelopment against a local sigil checkout
dev-redirects.sgl redirects codeberg:sigil/sigil to ../sigil. Pass it to the build CLI when you need to test against unreleased monorepo changes:
sigil build --redirects dev-redirects.sglOtherwise, let sigil deps install pull the pinned monorepo tag.
License
BSD-3-Clause. See package.sgl for author list.
Binary multipart forms
parse-form-data prefers a request's raw bytes for multipart input. File parts return a bytevector in content:; ordinary fields are independently decoded as UTF-8. Consumers that previously treated uploaded file content as text should decode explicitly only for text formats. parse-multipart-form-data-bytes is also available directly. It requires CRLF framing and a closing delimiter, with a maximum of 128 parts and 16 KiB of headers per part. The server request-size limit still controls the total body. The older string parser remains available.