Skip to content

Commit 06447ee

Browse files
committed
Merge TASK-067: remove v1 registered_resources* maps and namespace compat shim
2 parents 64a361f + 0caed6d commit 06447ee

19 files changed

Lines changed: 492 additions & 613 deletions

RELEASE_NOTES.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,32 @@ v1.x is end-of-life on the day v2.0 ships.
6565
must include them directly.
6666
- **The implicit conversion** `webserver ws = cw;` (where `cw` is a
6767
`create_webserver`). The constructor is now `explicit`.
68+
- **v1 compat auth-handler shim.** `httpserver::compat::auth_handler_v1_ptr`,
69+
`httpserver::compat::adapt_legacy_auth`, and the
70+
`[[deprecated]] create_webserver::auth_handler(compat::auth_handler_v1_ptr)`
71+
overload are removed (TASK-067). The transitional shim that let v1
72+
callers spell their auth handler as
73+
`std::function<std::shared_ptr<http_response>(const http_request&)>`
74+
was scheduled for removal "in the next release"; this is that removal.
75+
Migrate to the canonical `auth_handler_ptr` returning
76+
`std::optional<http_response>` (`std::nullopt` to allow, engaged value
77+
to reject). The `namespace httpserver::compat` is dissolved with no
78+
surviving members. **Source incompatibility:** TUs that called
79+
`auth_handler(<legacy shape>)` fail to compile against v2.1 headers;
80+
the legacy callable is no longer implicitly convertible to
81+
`auth_handler_ptr`. There is no runtime ABI surface to break — the
82+
overload was a header-only inline forwarder.
83+
- **v1 `registered_resources*` registration maps (internal).** No
84+
public-API change. Dispatch already routed through the v2 3-tier
85+
route table (`lookup_v2()`) after TASK-053; the residual
86+
registration-time maps (`registered_resources`,
87+
`registered_resources_str`, `registered_resources_regex`) and their
88+
shared mutex are now deleted (TASK-067). Lambda/class path-conflict
89+
detection consults the v2 route table directly via
90+
`find_v2_entry_by_path_`; duplicate-registration detection moved
91+
inside `register_v2_route`; the WebSocket handler registry gains a
92+
dedicated `registered_ws_handlers_mutex_`. Callers observe no
93+
behavioural change.
6894

6995
## What's new
7096

@@ -178,11 +204,7 @@ and see the v2 replacement.
178204
(earlier v2 work-in-progress shipped
179205
`std::function<std::shared_ptr<http_response>(const http_request&)>`).
180206
Return `std::nullopt` to allow the request; return an `http_response`
181-
to reject. The v1 `shared_ptr` shape still compiles via
182-
`httpserver::compat::auth_handler_v1_ptr` and a `[[deprecated]]`
183-
setter overload (both emit a deprecation warning); the compat alias
184-
and overload are scheduled for removal in v2.1.
185-
Removes one heap allocation per authenticated request.
207+
to reject. Removes one heap allocation per authenticated request.
186208
- **`http_request` getters return `const&` / `string_view`.** v1's
187209
`get_header(name)` (and `get_arg`, `get_cookie`, `get_footer`) returned
188210
by value and inserted an empty entry into the request map on miss; v2's

specs/architecture/04-components/route-table.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ A `route_entry` carries:
2727

2828
**Related requirements:** PRD-HDL-REQ-002, PRD-HDL-REQ-004, PRD-HDL-REQ-006.
2929

30-
**Implementation status:** TASK-025 introduced `detail::route_entry` and the `lambda_resource` shim into the existing v1 three-map storage shape. TASK-027 wired `route_entry` into the full 3-tier table described above (hash map for exact paths, radix tree for parameterized/prefix paths, regex chain for regex routes). TASK-053 retired the v1 dispatch path: `webserver_impl::resolve_resource_for_request` now consults `lookup_v2()` (cache → exact → radix → regex) directly, the v1 LRU cache and the four v1 lookup helpers (`lookup_route_cache`, `scan_regex_routes`, `store_route_cache`, `apply_extracted_params`) are deleted, and the LRU cache field is renamed `route_lru_cache`. The v1 registration-side maps (`registered_resources`, `registered_resources_str`, `registered_resources_regex`) survive *only* as registration-time bookkeeping for `prepare_or_create_lambda_shim` (lambda/class conflict detection) and the WebSocket dispatch path, both of which are non-HTTP-dispatch concerns; their removal is its own follow-up task. TASK-056 swapped the radix-node child container from `std::unordered_map` to `std::map<…, std::less<>>` for CWE-407 immunity and added registration-time detection of prefix-vs-exact terminus collisions (`reject_terminus_collision`).
30+
**Implementation status:** TASK-025 introduced `detail::route_entry` and the `lambda_resource` shim into the existing v1 three-map storage shape. TASK-027 wired `route_entry` into the full 3-tier table described above (hash map for exact paths, radix tree for parameterized/prefix paths, regex chain for regex routes). TASK-053 retired the v1 dispatch path: `webserver_impl::resolve_resource_for_request` now consults `lookup_v2()` (cache → exact → radix → regex) directly, the v1 LRU cache and the four v1 lookup helpers (`lookup_route_cache`, `scan_regex_routes`, `store_route_cache`, `apply_extracted_params`) are deleted, and the LRU cache field is renamed `route_lru_cache`. **TASK-067** deleted the v1 registration-side maps (`registered_resources`, `registered_resources_str`, `registered_resources_regex`) and their shared mutex; the v2 3-tier table is now the only routing surface end-to-end. Lambda/class path-conflict detection (`prepare_or_create_lambda_shim`) probes the v2 tiers via `find_v2_entry_by_path_`; the WebSocket registration map keeps its own `registered_ws_handlers_mutex_`. TASK-056 swapped the radix-node child container from `std::unordered_map` to `std::map<…, std::less<>>` for CWE-407 immunity and added registration-time detection of prefix-vs-exact terminus collisions (`reject_terminus_collision`).
3131

3232
---

specs/tasks/M7-v2-cleanup/TASK-067.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ Cut them in a single, well-tested PR so the v2 dispatch path is the only one.
3434
**Related Requirements:** PRD §2 API minimalism, PRD §1 release strategy
3535
**Related Decisions:** DR-007, DR-011
3636

37-
**Status:** Backlog
37+
**Status:** Done

specs/tasks/M7-v2-cleanup/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ TASK-093).
3131
| TASK-064 | Structured cookie type | HIGH | M | Backlog |
3232
| TASK-065 | RFC 5952 IPv6 zero-compression in `peer_address` | HIGH | S | Done |
3333
| TASK-066 | Runtime setter for hook alias slots | MED | M | Backlog |
34-
| TASK-067 | Remove v1 `registered_resources*` maps and `namespace compat` shim | MED | L | Backlog |
34+
| TASK-067 | Remove v1 `registered_resources*` maps and `namespace compat` shim | MED | L | Done |
3535
| TASK-068 | `connection_state` hardening — CWE-226 / CWE-14 | MED | S | Backlog |
3636
| TASK-069 | Remove transitional two-arg `http_request_impl` constructor | MED | S | Backlog |
3737
| TASK-070 | Migrate `hook_table_` to `std::atomic<std::shared_ptr<T>>` | MED | M | Backlog |

0 commit comments

Comments
 (0)