Skip to content

Gen3 - #6

Merged
valentinbreiz merged 5 commits into
mainfrom
gen3
Oct 3, 2026
Merged

valentinbreiz merged 5 commits into
mainfrom
gen3

Conversation

@valentinbreiz

Copy link
Copy Markdown
Member

No description provided.

Cosmos.Network.Http 2.0.0 is a plain net10.0 library over
System.Net.Sockets, with no Cosmos reference, like Cosmos.Network.Ftp: a
Gen3 kernel runs it on its network stack through the socket and DNS
plugs, and a desktop runs it as is.

new HttpRequest(url).Send() returns the response whole: status, headers
and body, error statuses included, with EnsureSuccessStatusCode and
GetString on top. Requests set their method, body, headers, timeout and
redirect limit. Bodies end at their Content-Length, their last chunk or
the end of the connection, so a server that keeps it open is not waited
for. 1xx responses are skipped, redirects are followed (a 303 turns into
a GET), and https:// is refused: there is no TLS.

It works around the Gen3 socket plugs: host names are resolved before
connecting, only the byte[] receive overloads are used, the socket is
closed outside finally, and the waiting is done by Socket.Poll, never
Thread.Sleep, so a request may run on the kernel's main loop. Responses
come without content coding, which drops the Zlib.Portable dependency.
The request tests send to a loopback server that answers with bytes the
test writes out, and check both directions: the request line and
headers, bodies framed by length, chunks or the end of the connection,
servers that keep the connection open, HEAD, POST, redirects and their
limit, error statuses, timeouts, truncated bodies, refused connections
and unknown hosts. The response reader is fed every split of a response
a connection could deliver, and URL parsing and redirect resolution are
unit-tested on their own.
Build, test and pack on every push and pull request. A v<version> tag
also publishes that version, trading GitHub's OIDC token for a
short-lived nuget.org key instead of storing one.
@valentinbreiz
valentinbreiz merged commit d93d6c9 into main Oct 3, 2026
3 checks 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