tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Net, HTTP: Bytes IO, keep-alive and chunked request bodies (issue #36)

`std/net` reads and writes `Bytes` (`write_string` sends text), so
binary data is no longer altered: reads used to replace invalid UTF-8.

`std/http` requests and responses carry `Bytes` bodies (`http.response`
takes any content type; `body_text` and `form_body` decode), and each
connection's actor now serves requests one after another:
- HTTP/1.1 connections stay open unless the request or the response
  says `Connection: close`; HTTP/1.0 ones only with `keep-alive`;
- pipelined requests are served in order from the same buffer;
- bodies are sized by Content-Length or chunked (chunk extensions and
  trailers are accepted); both framings at once, an invalid or
  conflicting Content-Length, and other transfer codings are rejected,
  since a misread length would desynchronize a kept-alive connection;
- `Expect: 100-continue` is answered, HEAD responses have no body;
- a watchdog actor per connection, monitoring it, closes the socket when
  the connection waits longer than the idle timeout (5 s by default,
  `http.serve_with` and `Settings` to change it) for a request or for
  more of one. The scheduler is unchanged: the timeout is a `select`
  timeout.

The runtime parses heads and chunk sizes with httparse from an offset,
returning offsets, so pipelined requests and small chunks are not copied
one by one; large bodies are accumulated with a builder.

The HTTP end-to-end test now also sends two pipelined requests and a
chunked body on one kept-alive connection, gets a binary response, and
checks that the idle connection is closed. The demo's clients ask for
`Connection: close`, since they read replies to the end of the stream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

olivier · il y a 1 mois · d83d5fb4b2583354fe572f25fdc908dcf5e3f958

Parents 0cbf40c

10 fichiers modifiés, 548 ajouts, 160 suppressions