Skip to content

Commit 03833f5

Browse files
committed
fix: clean up duplicated lines in cURL HeaderCallback after suggestion merge
1 parent 96fd212 commit 03833f5

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

libs/server-sent-events/src/curl_client.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -428,20 +428,11 @@ size_t CurlClient::HeaderCallback(char const* buffer,
428428
auto* context = static_cast<RequestContext*>(userdata);
429429

430430
std::string_view line(buffer, total_size);
431-
if (line.size() >= 2 && line[line.size() - 2] == '\r' &&
432-
line.back() == '\n') {
433-
line.remove_suffix(2);
434-
}
435431

436-
if (line.empty()) {
437-
// End-of-headers terminator: emit and reset.
438-
context->response(std::move(context->current_response));
439-
context->current_response = http::response_header<>{};
440432
// Strip the line terminator. Allow bare LF or bare CR per RFC 9112 §2.2;
441433
// libcurl preserves the original wire bytes for HTTP/1.x (only HTTP/2
442434
// synthesizes CRLF), so a non-compliant origin can deliver bare LF here.
443-
while (!line.empty() &&
444-
(line.back() == '\r' || line.back() == '\n')) {
435+
while (!line.empty() && (line.back() == '\r' || line.back() == '\n')) {
445436
line.remove_suffix(1);
446437
}
447438

0 commit comments

Comments
 (0)