mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-08-12 21:31:25 +00:00
* reject crlf in request target in write_request_line * declare write_request_line in test.cc for split builds split.py strips `inline` and moves the definition into httplib.cc, so detail::write_request_line is not visible from the split httplib.h and test_split failed to compile. Re-declare it in test.cc, matching what the base64_encode and getaddrinfo_with_timeout tests already do. * Fail the request when write_request_line rejects the target The CR/LF guard in write_request_line returns -1, but ClientImpl::write_request ignored that return value. A rejected target therefore produced a request-line- less request (headers only) that the client silently reported as a successful send. This is the primary path reachable via a decoded redirect Location under set_path_encode(false), and it also carries the CONNECT target. Check the return value like ClientImpl::open_stream already does and fail with Error::Write. Add an end-to-end test asserting the client refuses a CR/LF target instead of putting it on the wire. --------- Co-authored-by: Sayed Kaif <metsw24@gmail.com>