From b70a0efa9e95a3cfdf9e629ab00f2610fc64e162 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Tue, 13 Dec 2022 21:45:52 +0000 Subject: [PATCH] NetServices: Notify any async listeners when a request completes early. The API allows a user to end parsing responses earlier if the response has a client (4xx) or server (5xx) error code. The end user should still be notified of this result, so that they can act. Change-Id: I11f2ab296658f767b5b34e10badb54de27aab494 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5910 Tested-by: Commit checker robot Reviewed-by: Adrien Destugues Reviewed-by: waddlesplash --- src/kits/network/libnetservices2/HttpSession.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kits/network/libnetservices2/HttpSession.cpp b/src/kits/network/libnetservices2/HttpSession.cpp index ccee304120..558d292a12 100644 --- a/src/kits/network/libnetservices2/HttpSession.cpp +++ b/src/kits/network/libnetservices2/HttpSession.cpp @@ -888,6 +888,8 @@ BHttpSession::Request::ReceiveResult() fResult->SetStatus(std::move(fStatus)); fResult->SetFields(BHttpFields()); fResult->SetBody(); + SendMessage(UrlEvent::RequestCompleted, + [](BMessage& msg) { msg.AddBool(UrlEventData::Success, true); }); return true; }