Skip to content

Http client#71

Merged
mdbergmann merged 19 commits into
masterfrom
http-client
Feb 12, 2026
Merged

Http client#71
mdbergmann merged 19 commits into
masterfrom
http-client

Conversation

@mdbergmann
Copy link
Copy Markdown
Owner

No description provided.

mdbergmann and others added 19 commits February 11, 2026 19:32
Generate bsdsocket, amisslmaster, and amissl BMAPs using fd2bmap
on the Amiga emulator. Add httpclient submod scaffolding (Make,
test_bmap.b) and HTTPClient.h public API header. Verified test_bmap.b
compiles successfully against bsdsocket.bmap.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Implement the transport layer for the HTTP client submodule:
- httpclient.b module with socket, DNS, connect, send, recv, close
- Connection table (4 slots, 1-based handles) via bsdsocket.library
- HttpOpen/HttpClose public API + raw byte helpers for testing
- Stubs for all remaining API functions
- Fix reserved-word parameter names in HTTPClient.h (name, val, len)
- test_tcp.b verified: connects to www.google.com:80, HTTP GET, 200 OK

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Implements URL parsing, request/response formatting, header management,
body reading, and HttpGet/HttpHead convenience functions. STRING params
are pass-by-value in ACE, so respBuf uses ADDRESS (caller passes SADD).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add chunk decoder state machine that transparently handles
Transfer-Encoding: chunked responses in HttpReadBody. New helpers:
_HttpParseHex, _HttpReadBuf, _HttpReadChunked. Also rename header
arrays for clarity (_rHdr→_respHdr, _qHdr→_reqHdr), remove unused
_bodyBuf, and raise MAX_GET_BODY to 64KB.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Implement HttpWriteBody, HttpWriteBodyChunked, UrlEncode, HttpRequest,
HttpPost, and HttpPut - replacing stubs with full implementations.
Verified on emulator: POST form data, PUT JSON, GET via HttpRequest,
and UrlEncode all pass against httpbin.org.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add streaming API using INVOKABLE SUBs + BIND closures + INVOKE dispatch,
enabling binary downloads and chunked uploads without loading entire bodies
into memory.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add HTTPS support via AmiSSL library using inline assembly (ASSEM)
wrappers to call exec OpenLibrary directly, enabling graceful failure
when AmiSSL is not installed. All existing HTTP functions automatically
gain HTTPS support through SSL branching in _HttpSendRaw/_HttpRecvRaw.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…ent submodule

Add bufSz parameter to HttpGet, HttpRequest, HttpPost, HttpPut to prevent
buffer overflows when response exceeds caller's buffer. Fix HttpSendRequest
to check return values of all header sends. Fix test_http_get off-by-one
in low-level read loop. All 6 tests (15 cases) pass.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
…P_SUCCESS

Document all public API functions with parameter descriptions, return
values, usage notes, callback signatures, and typical call sequences.
Add module-level documentation noting thread-safety constraints and
limitations. Rename HTTP_OK to HTTP_SUCCESS to avoid confusion with
HTTP 200 OK status code.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Allocate the 16-byte sockaddr_in buffer once in _HttpInit instead of
on every _HttpConnectTCP call, preventing a small per-connection leak.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
High-level and streaming APIs close the connection internally,
so response headers are not accessible. Document this limitation
and point users to the low-level handle API.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add HttpResponseHeaderCount, HttpResponseHeaderName, and
HttpResponseHeaderVal to allow iterating over all response headers
by index, complementing the existing name-based lookup.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
test_lowlevel_full.b covers HttpSetHeader, response header enumeration,
HttpWriteBody, HttpWriteBodyChunked, and invalid handle edge cases.
RunTests is an AmigaDOS script that builds the module and runs all 8
tests in sequence with output to a configurable file.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace 4-slot connection table (10 DIM arrays) with scalar variables.
One connection at a time; caller must HttpClose before re-opening.

- Replace DIM arrays with scalar _conn* variables
- Remove _HttpAllocSlot, _bufSlot, _respHdrSlot
- Remove slot parameter from 8 internal helpers
- Simplify all 12 public APIs: validate h=1 instead of slot range
- HttpOpen returns fixed handle 1, checks _connState directly
- HttpClose always resets buffer and headers unconditionally
- Update limitation text in HTTPClient.h and README.txt
- All 8 tests pass (module 1861→1800 lines, .o 58KB→51KB)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Clear _reqHdrCount on close so stale headers don't carry over
if HttpSetHeader was called without a subsequent HttpSendRequest.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@mdbergmann mdbergmann merged commit d066c41 into master Feb 12, 2026
@mdbergmann mdbergmann mentioned this pull request Feb 12, 2026
@mdbergmann mdbergmann deleted the http-client branch February 19, 2026 19:56
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