Skip to content

Httpclient + server - #8

Merged
valentinbreiz merged 2 commits into
mainfrom
httpclient
Oct 4, 2026
Merged

valentinbreiz merged 2 commits into
mainfrom
httpclient

Conversation

@valentinbreiz

Copy link
Copy Markdown
Member

No description provided.

Replace the client with nanoframework/System.Net.Http (384a926): its
nanoFramework.System.Net.Http, .Client and .Server projects copied as is
into src/Cosmos.Network.Http, .Client and .Server. Only the project
folder links in the .nfproj and the AssemblyInfo title are renamed.
Cosmos.Network.Http 3.0.0: nanoFramework's HttpClient, HttpWebRequest and
HttpListener, with the NetworkStream, SslStream and X.509 parts of its
System.Net, on Cosmos's BCL sockets. nano's tree and file names are kept,
every port edit carries a "Cosmos:" comment, and one csproj builds it all.

- TLS 1.3 and 1.2, client and server, on BouncyCastle driven without
  blocking (Security/SslNative.cs, in place of nano's native mbedTLS layer),
  with the certificate check mbedTLS ran (Security/CertificateVerifier.cs)
  against the Mozilla roots or a given CA.
- HttpListener serves every connection on the thread calling GetContext:
  accepts, advances TLS handshakes, watches kept-alive connections. Stop,
  Close and Abort from another thread leave the sockets to that one.
- No finally, using or lock on a throwing path, no null dereference: a
  Cosmos kernel skips the first while unwinding and panics on the second.
- nano bugs fixed along the way: chunked responses never ended, keep-alive
  never reused a connection, Host without its port, User-Agent refused,
  no way to read a response header, truncated bodies taken as complete.

Tests: nanoFramework's HttpUnitTests on MSTest (but its own Uri's), plus
TLS, certificate, key and HttpClient-HttpListener loopback tests.
@valentinbreiz
valentinbreiz merged commit 00ec7a6 into main Oct 4, 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