Skip to content

Commit cbe1d6b

Browse files
committed
added info about 100-continue, cleanded TODO
1 parent a62f081 commit cbe1d6b

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,25 @@ Tests run automatically on push/PR via GitHub Actions:
558558
- MicroPython tests: Self-hosted runner with ESP32
559559

560560

561-
## TODO
561+
## Expect: 100-continue
562562

563-
- Cookie attributes support (Path, Domain, Secure, HttpOnly, SameSite, Expires)
564-
- Expect: 100-continue support - currently causes deadlock (client waits for 100, server waits for body)
565-
- Streaming API for sending large responses (handle EAGAIN)
566-
- Chunked transfer encoding support (receiving and sending)
563+
Server supports `Expect: 100-continue` header for large uploads:
564+
565+
**Non-event mode:** Server automatically sends `100 Continue` response when client sends `Expect: 100-continue` header, then waits for body.
566+
567+
**Event mode:** Server sends `100 Continue` only when application calls `accept_body()`. This allows rejecting uploads early (e.g., respond with 413 or 401) without accepting body data.
568+
569+
```python
570+
from uhttp.server import HttpServer, EVENT_HEADERS
571+
572+
server = HttpServer(port=8080, event_mode=True)
573+
574+
while True:
575+
client = server.wait()
576+
if client and client.event == EVENT_HEADERS:
577+
if client.content_length > MAX_ALLOWED:
578+
# No 100 Continue sent - client won't upload
579+
client.respond({'error': 'too large'}, status=413)
580+
else:
581+
client.accept_body() # Sends 100 Continue, starts receiving
582+
```

0 commit comments

Comments
 (0)