You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TASK-009: http_response value type with SBO buffer + detail/ rename
Convert http_response from a copy-able subclass-rooted type to a
move-only value type that carries a 64-byte SBO buffer for the
polymorphic body. Also rename src/[httpserver/]details/ to
src/[httpserver/]detail/ so the directory name matches the
httpserver::detail namespace (resolves the plural/singular mismatch
left by TASK-008).
Layout (PRD-HDR-REQ-004 exemption, DR-005):
- status_code_, headers_, footers_, cookies_, kind_
- alignas(16) std::byte body_storage_[64]
- detail::body* body_, bool body_inline_
- public: body_pointer_type = detail::body*, body_buf_size = 64
The body lives in body_storage_ inline (the common case) or on the
heap via ::operator new(sizeof(T))+placement-new for outsized bodies.
body_inline_ discriminates so the destructor knows whether to invoke
::operator delete. Hand-written noexcept move ctor and move-assign
cover all four inline/heap cross-product cases through two
single-source helpers (destroy_body / adopt_body_from); copy ops are
deleted (DR-005). Self-move-assign is guarded explicitly.
Detail layer amendment (TASK-008 follow-up): re-enable noexcept move
construction on detail::body subclasses and add a noexcept
move_into(void*) virtual so http_response can placement-move an
inline body across SBO buffers without copying. file_body and
pipe_body get hand-written move ctors that std::exchange fd_ and
flip materialized_ to suppress double-close in the moved-from object.
Per-subclass static_assert(std::is_nothrow_move_constructible_v<>)
locks the contract in.
V1 subclass headers (string/file/empty/digest/basic/deferred response)
now declare = delete for copy ops to follow the move-only base. The
iovec/pipe response headers were already deleted-copy.
`final` is deferred to TASK-013 (the v1 subclasses still inherit at
this point; TASK-013 removes them and seals the class). The class
stays virtual-destructor for the same reason. Test TU exercises the
SBO 4-case cross-product through a single friend struct
(http_response_sbo_test_access) declared in the header.
Test:
- 26 testsuite entries (was 25), all green; new http_response_sbo
test passes 10 tests / 30 checks
- body_test still green (detail/ amendment is contract-compatible)
- new SBO test sanitizer-clean under ASan + UBSan
- cpplint clean across all changed files
Refs: PRD-HDR-REQ-004 (exemption clause), PRD-RSP-REQ-001,
PRD-RSP-REQ-007, DR-003a, DR-005
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments