tobogganSe connecter

louise

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

Std: requests carry the client's address (issue #308, ADR 0012 rev. 4)

A handler could not tell which client sent a request, so per-client
rate limits, connection caps and access logs were impossible (toki2
dropped its per-client login bucket).

- `net.peer(conn)`: a connection's other end, `SocketAddress(host,
  port)`, recorded by the runtime when it accepts or makes it.
- The server puts it first among each request's headers as the
  pseudo-header `:peer`, which no client can send (a header name cannot
  hold `:`; a test pins the 400). `Request` keeps its four fields:
  `http.peer(req)` reads it, `None` for requests built by hand, and
  `http.wire_headers(req)` leaves it out.
- `http.client_address(req, trusted)`: the peer, or behind trusted
  proxies the right-most untrusted `X-Forwarded-For` entry; an untrusted
  peer's `X-Forwarded-For` is ignored.
- The tutorial builds a per-client rate limit on it.

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

olivier · il y a 1 mois · 0e68f2c2918d387123de574ea7167feed2b9f707

Parents f607302

13 fichiers modifiés, 494 ajouts, 10 suppressions