Commit d06f4f7
committed
version 20260520.0: modernize codebase, fix protocol bugs, expand test suite
rocket3/__init__.py:
- Drop Python 2 / Jython compatibility (IS_JYTHON, _read_request_line_jython,
FileLikeSocket, has_ssl fallback, optparse).
- Switch to super() calls, context-managed locks, OSError, callable(), and
lazy %-args logging throughout.
- Fix RESPONSE template to use CRLF (was bare LF, violating HTTP spec).
- Fix inverted status-code check that incorrectly added Content-Length to
1xx/204/205/304 responses.
- Fix typo: ssl context verify_model -> verify_mode.
- Reorder SSL exception handlers so SSLCertVerificationError (subclass) is
caught before SSLError.
- Make stop() idempotent (RLock + _stopping flag) and install an explicit
SIGINT handler so Ctrl-C shuts the server down cleanly.
- ThreadPool.stop() now actually joins workers with a bounded deadline
(was previously commented-out dead code, causing hangs).
- Harden demo_app against path traversal via _safe_join; replace optparse
with argparse.
- Rename shadowed in threadpool section to .
Build:
- Makefile reworked around uv (uv build / uv tool run ruff) with check,
format, test, build, publish targets; add uv.lock.
Tests:
- Rewrite test_http / test_https around pytest fixtures with ephemeral
ports and a shared make_server / dual_server harness (tests/conftest.py).
- Add coverage for keep-alive, HEAD, malformed request lines, CRLF header
framing, and HTTP/HTTPS port-mismatch behavior.
- Add tests/test_units.py for unit-level coverage.1 parent 4154030 commit d06f4f7
9 files changed
Lines changed: 920 additions & 529 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
13 | | - | |
| 19 | + | |
14 | 20 | | |
15 | | - | |
16 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
17 | 29 | | |
| 30 | + | |
18 | 31 | | |
19 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
20 | 38 | | |
21 | 39 | | |
22 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
23 | 61 | | |
24 | 62 | | |
25 | 63 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments