Gen3 - #6
Merged
Merged
Gen3#6
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.