mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-19 11:19:36 +00:00
Skip every interim response, with its header fields
Only 100 Continue was skipped, and only without header fields, so a 103 Early Hints was taken for the final response and a 100 with fields threw the parsing off. Skip every 1xx but 101, along with its header fields.
This commit is contained in:
1 parent
5d10305218
commit
ce7ecb633b
2 files changed
+67
-3
No files matched your search
@@ -15280,9 +15280,13 @@ inline bool ClientImpl::read_response_line(Stream &strm, const Request &req,
|
||||
return req.method == "CONNECT";
|
||||
}
|
||||
|
||||
// Ignore '100 Continue' (only when not using Expect: 100-continue explicitly)
|
||||
while (skip_100_continue && res.status == StatusCode::Continue_100) {
|
||||
if (!line_reader.getline()) { return false; } // CRLF
|
||||
// Skip interim responses, such as 100 Continue (unless Expect:
|
||||
// 100-continue is handled by the caller) and 103 Early Hints, along with
|
||||
// their header fields. 101 ends HTTP on the connection, so it is final.
|
||||
while (skip_100_continue && 100 <= res.status && res.status < 200 &&
|
||||
res.status != StatusCode::SwitchingProtocol_101) {
|
||||
Headers interim_headers;
|
||||
if (!detail::read_headers(strm, interim_headers)) { return false; }
|
||||
if (!line_reader.getline()) { return false; } // next response line
|
||||
|
||||
if (!detail::parse_status_line(line_reader.ptr(), res.version, res.status,
|
||||
|
||||
Reference in new issue
Block a user