Truly independent web browser
LibWeb: Define the fetch engine command and event envelope
Luke Wildea0fcaa3784c5
diff --git a/Libraries/LibWeb/Fetch/Engine/BodyIntent.h b/Libraries/LibWeb/Fetch/Engine/BodyIntent.hnew file mode 100644index 00000000000..ae05dbdf873--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/BodyIntent.h@@ -0,0 +1,21 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Types.h>++namespace Web::Fetch::Engine {++// Who consumes the response body.+enum class BodyIntent : u8 {+ DeliverStreamToConsumerAgent,+ ConsumeForCallback,+ DrainAndDiscard,+ SyncAccumulate,+};++}diff --git a/Libraries/LibWeb/Fetch/Engine/BodyPresentation.h b/Libraries/LibWeb/Fetch/Engine/BodyPresentation.hnew file mode 100644index 00000000000..04673ac7f16--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/BodyPresentation.h@@ -0,0 +1,41 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Variant.h>+#include <LibCore/ImmutableBytes.h>++namespace Web::Fetch::Engine {++struct NullBody {+ bool operator==(NullBody const&) const = default;+};++// A delivered body is never null.+template<typename Handle>+class Delivered {+public:+ explicit Delivered(Handle handle)+ : m_handle(move(handle))+ {+ VERIFY(m_handle.is_valid());+ }++ Handle const& handle() const { return m_handle; }++private:+ Handle m_handle;+};++using NonNullLocalBodyHandle = Core::ImmutableBytes;++template<typename Handle>+using BodyPresentation = Variant<NullBody, Delivered<Handle>>;++using LocalBodyPresentation = BodyPresentation<NonNullLocalBodyHandle>;++}diff --git a/Libraries/LibWeb/Fetch/Engine/EngineCommand.h b/Libraries/LibWeb/Fetch/Engine/EngineCommand.hnew file mode 100644index 00000000000..8bafe1660cd--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/EngineCommand.h@@ -0,0 +1,93 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Variant.h>+#include <LibIPC/TransportHandle.h>+#include <LibWeb/Fetch/Engine/BodyPresentation.h>+#include <LibWeb/Fetch/Engine/Ids.h>+#include <LibWeb/Fetch/Engine/StartFetchInput.h>++namespace Web::Fetch::Engine::Command {++struct StartFetch {+ StartFetchInput input;+};++struct Abort {+ FetchId fetch_id;+};++struct Terminate {+ FetchId fetch_id;+};++struct Stop {+ FetchId fetch_id;+};++// The answer to a manual-redirect delivery's continuation, given exactly once.+struct ResolveRedirect {+ struct Follow { };+ struct AcceptAsFinal { };+ struct Abandon { };+ using Resolution = Variant<Follow, AcceptAsFinal, Abandon>;++ DeliveryId delivery_id;+ ContinuationId continuation_id;+ Resolution resolution;+};++// Only ever complete: all bytes present, or a network error with no body.+struct CompletedPreloadResponse {+ struct Completed {+ Delivered<Core::ImmutableBytes> body;+ };+ struct Failure {+ NullBody body;+ };++ Variant<Completed, Failure> outcome;+};++struct PreloadResponseResolved {+ FetchId fetch_id;+ CompletedPreloadResponse response;+};++struct TransportControl {+ struct ResumeBodyDeliveryUpTo {+ u64 byte_count { 0 };+ };+ struct PauseBodyDelivery { };+ struct StopTransport { };+ using Operation = Variant<ResumeBodyDeliveryUpTo, PauseBodyDelivery, StopTransport>;++ RequestId request_id;+ TransportEpoch transport_epoch;+ Operation operation;+};++struct AdoptNetworkTransport {+ IPC::TransportHandle handle;+};++}++namespace Web::Fetch::Engine {++using EngineCommand = Variant<+ Command::StartFetch,+ Command::Abort,+ Command::Terminate,+ Command::Stop,+ Command::ResolveRedirect,+ Command::PreloadResponseResolved,+ Command::TransportControl,+ Command::AdoptNetworkTransport>;++}diff --git a/Libraries/LibWeb/Fetch/Engine/EngineCommandSink.h b/Libraries/LibWeb/Fetch/Engine/EngineCommandSink.hnew file mode 100644index 00000000000..c56619ba675--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/EngineCommandSink.h@@ -0,0 +1,24 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/kmalloc.h>+#include <LibWeb/Fetch/Engine/EngineCommand.h>++namespace Web::Fetch::Engine {++// Receives every posted command on the engine's thread, in posting order.+class EngineCommandSink {+public:+ AK_ALLOC_WITH_KMALLOC;++ virtual ~EngineCommandSink() = default;++ virtual void handle_command(EngineCommand) = 0;+};++}diff --git a/Libraries/LibWeb/Fetch/Engine/EngineEvent.h b/Libraries/LibWeb/Fetch/Engine/EngineEvent.hnew file mode 100644index 00000000000..f56c32024bf--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/EngineEvent.h@@ -0,0 +1,87 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Variant.h>+#include <LibWeb/Fetch/Engine/BodyPresentation.h>+#include <LibWeb/Fetch/Engine/FetchTimingSeed.h>+#include <LibWeb/Fetch/Engine/Ids.h>+#include <LibWeb/Fetch/Engine/RequestEnd.h>+#include <LibWebCommon/HighResolutionTime/DOMHighResTimeStamp.h>++namespace Web::Fetch::Engine::Event {++struct ResponseDelivery {+ DeliveryId delivery_id;+ LocalBodyPresentation body;+ FetchTimingSeed timing_seed;+};++// Sent once per delivery after its last byte, whether or not the transport has completed.+struct EndOfBody {+ struct FinalSizes {+ u64 encoded_body_size { 0 };+ u64 decoded_body_size { 0 };+ };++ DeliveryId delivery_id;+ FinalSizes final_sizes;+ HighResolutionTime::DOMHighResTimeStamp end_time { 0 };+};++struct ConsumeBodyResult {+ struct Null { };+ struct Bytes {+ Core::ImmutableBytes bytes;+ };+ struct Failure { };+ using Outcome = Variant<Null, Bytes, Failure>;++ DeliveryId delivery_id;+ Outcome outcome;+};++struct BodyChannelReadable {+ DeliveryId delivery_id;+ WakeTicket ticket { 0 };+};++// A delivery's end, committed exactly once by the engine.+struct DeliveryEnd {+ struct Released { };+ struct Revoked { };+ using Outcome = Variant<Released, Revoked>;++ DeliveryId delivery_id;+ Outcome outcome;+};++struct RequestTransmissionStarted {+ TransmissionId transmission_id;+ TransmissionGeneration generation;+};++struct RequestTransmissionEnded {+ TransmissionId transmission_id;+ TransmissionGeneration generation;+ RequestEnd request_end;+};++}++namespace Web::Fetch::Engine {++using EngineEvent = Variant<+ Event::ResponseDelivery,+ Event::EndOfBody,+ Event::ConsumeBodyResult,+ Event::BodyChannelReadable,+ Event::DeliveryEnd,+ Event::RequestTransmissionStarted,+ Event::RequestTransmissionEnded>;++}diff --git a/Libraries/LibWeb/Fetch/Engine/EngineEventSink.h b/Libraries/LibWeb/Fetch/Engine/EngineEventSink.hnew file mode 100644index 00000000000..e9f573c9a25--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/EngineEventSink.h@@ -0,0 +1,24 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/kmalloc.h>+#include <LibWeb/Fetch/Engine/EngineEvent.h>++namespace Web::Fetch::Engine {++// Receives every event for a fetch on its agent's thread, in sending order.+class EngineEventSink {+public:+ AK_ALLOC_WITH_KMALLOC;++ virtual ~EngineEventSink() = default;++ virtual void handle_event(EngineEvent) = 0;+};++}diff --git a/Libraries/LibWeb/Fetch/Engine/FetchTimingSeed.h b/Libraries/LibWeb/Fetch/Engine/FetchTimingSeed.hnew file mode 100644index 00000000000..9299f779c08--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/FetchTimingSeed.h@@ -0,0 +1,32 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Optional.h>+#include <AK/String.h>+#include <AK/Vector.h>+#include <LibWebCommon/Fetch/Infrastructure/ConnectionTimingInfo.h>+#include <LibWebCommon/HighResolutionTime/DOMHighResTimeStamp.h>++namespace Web::Fetch::Engine {++// The timing fields settled at final response handover.+struct FetchTimingSeed {+ HighResolutionTime::DOMHighResTimeStamp start_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp redirect_start_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp redirect_end_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp post_redirect_start_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp final_service_worker_start_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp final_network_request_start_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp first_interim_network_response_start_time { 0 };+ HighResolutionTime::DOMHighResTimeStamp final_network_response_start_time { 0 };+ Optional<Infrastructure::ConnectionTimingInfo> final_connection_timing_info;+ Vector<String> server_timing_headers;+ bool render_blocking { false };+};++}diff --git a/Libraries/LibWeb/Fetch/Engine/Ids.h b/Libraries/LibWeb/Fetch/Engine/Ids.hnew file mode 100644index 00000000000..3da90bdb42c--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/Ids.h@@ -0,0 +1,29 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/DistinctNumeric.h>+#include <AK/Types.h>++namespace Web::Fetch::Engine {++// Never reused within a process.+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, FetchId);+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, DeliveryId);+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, ContinuationId);+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, TransmissionId);+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, TransmissionGeneration);+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, AttemptId);++// Identifies one wait for a body's bytes, and travels with the wake that ends it.+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, WakeTicket);++// A request id is meaningful only for the epoch of the client that minted it.+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, RequestId);+AK_TYPEDEF_DISTINCT_ORDERED_ID(u64, TransportEpoch);++}diff --git a/Libraries/LibWeb/Fetch/Engine/RequestEnd.h b/Libraries/LibWeb/Fetch/Engine/RequestEnd.hnew file mode 100644index 00000000000..f6522570b32--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/RequestEnd.h@@ -0,0 +1,52 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Time.h>+#include <AK/Variant.h>+#include <LibRequests/ALPNHttpVersion.h>+#include <LibRequests/NetworkError.h>+#include <LibWeb/Fetch/Engine/Ids.h>++namespace Web::Fetch::Engine {++// One arm per way a request can end.+struct RequestEnd {+ struct NetworkSuccess {+ AttemptId attempt_id;+ u64 encoded_body_size { 0 };+ Requests::ALPNHttpVersion alpn { Requests::ALPNHttpVersion::None };+ };+ struct LocalSuccess {+ u64 encoded_body_size { 0 };+ };+ struct AttemptFailedBeforeHeaders {+ AttemptId attempt_id;+ Requests::NetworkError error;+ };+ struct CommittedAttemptFailed {+ AttemptId attempt_id;+ Requests::NetworkError error;+ u64 encoded_body_size { 0 };+ };+ struct LocalFailed {+ Requests::NetworkError error;+ u64 encoded_body_size { 0 };+ };+ struct FailedBeforeTransport {+ Requests::NetworkError error;+ };++ using Outcome = Variant<NetworkSuccess, LocalSuccess, AttemptFailedBeforeHeaders, CommittedAttemptFailed, LocalFailed, FailedBeforeTransport>;++ RequestId request_id;+ TransportEpoch transport_epoch;+ MonotonicTime transport_complete_at;+ Outcome outcome;+};++}diff --git a/Libraries/LibWeb/Fetch/Engine/StartFetchInput.h b/Libraries/LibWeb/Fetch/Engine/StartFetchInput.hnew file mode 100644index 00000000000..20032354b02--- /dev/null+++ b/Libraries/LibWeb/Fetch/Engine/StartFetchInput.h@@ -0,0 +1,24 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <AK/Optional.h>+#include <LibWeb/Fetch/Engine/BodyIntent.h>+#include <LibWeb/Fetch/Engine/Ids.h>+#include <LibWebCommon/FileAPI/SerializedBlobURLEntry.h>++namespace Web::Fetch::Engine {++struct StartFetchInput {+ FetchId fetch_id;+ BodyIntent body_intent;++ // Resolved by the agent that starts the fetch, at fetch start.+ Optional<FileAPI::SerializedBlobURLEntry> blob_url_entry;+};++}diff --git a/Tests/LibWeb/CMakeLists.txt b/Tests/LibWeb/CMakeLists.txtindex da518088c17..ddd726ffffc 100644--- a/Tests/LibWeb/CMakeLists.txt+++ b/Tests/LibWeb/CMakeLists.txt@@ -11,6 +11,7 @@ set(TEST_SOURCESTestDump.cppTestEventLoop.cppTestFaviconDecoding.cpp+ TestFetchEngineMessages.cppTestFetchResponse.cppTestFetchURL.cppTestHTMLTokenizer.cpp@@ -61,6 +62,7 @@ endforeach()target_link_libraries(BenchmarkDisplayListRecording PRIVATE LibGC LibGfx LibIPC LibJS LibURL LibWebView)target_link_libraries(TestAudioWorkletPipe PRIVATE LibCore LibThreading)target_link_libraries(TestContentBlocker PRIVATE LibURL)+target_link_libraries(TestFetchEngineMessages PRIVATE LibCore LibIPC LibRequests)if (NOT WIN32)target_link_libraries(TestCSSSyntaxParser PRIVATE LibThreading)endif()diff --git a/Tests/LibWeb/TestFetchEngineMessages.cpp b/Tests/LibWeb/TestFetchEngineMessages.cppnew file mode 100644index 00000000000..2c44d7c4b72--- /dev/null+++ b/Tests/LibWeb/TestFetchEngineMessages.cpp@@ -0,0 +1,158 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#include <AK/StdLibExtras.h>+#include <LibIPC/Transport.h>+#include <LibTest/TestCase.h>+#include <LibWeb/Fetch/Engine/EngineCommand.h>+#include <LibWeb/Fetch/Engine/EngineEvent.h>++using namespace Web::Fetch::Engine;++// A command is handed to the engine exactly once.+static_assert(!IsCopyConstructible<EngineCommand>);+static_assert(IsMoveConstructible<EngineCommand>);++// A completed preload response is all its bytes or a network error, and a delivered body is never null.+static_assert(!IsConstructible<Command::CompletedPreloadResponse::Completed, NullBody>);+static_assert(!IsConstructible<Delivered<NonNullLocalBodyHandle>, NullBody>);++TEST_CASE(commands_round_trip_their_payloads)+{+ Vector<EngineCommand> commands;+ commands.append(Command::StartFetch { .input = { .fetch_id = FetchId(1), .body_intent = BodyIntent::DrainAndDiscard, .blob_url_entry = {} } });+ commands.append(Command::Abort { .fetch_id = FetchId(2) });+ commands.append(Command::Terminate { .fetch_id = FetchId(3) });+ commands.append(Command::Stop { .fetch_id = FetchId(4) });+ commands.append(Command::ResolveRedirect { .delivery_id = DeliveryId(5), .continuation_id = ContinuationId(6), .resolution = Command::ResolveRedirect::AcceptAsFinal {} });+ commands.append(Command::PreloadResponseResolved {+ .fetch_id = FetchId(7),+ .response = { .outcome = Command::CompletedPreloadResponse::Completed { .body = Delivered<Core::ImmutableBytes> { Core::ImmutableBytes::adopt(MUST(ByteBuffer::copy("preloaded"sv.bytes()))) } } },+ });+ commands.append(Command::TransportControl { .request_id = RequestId(8), .transport_epoch = TransportEpoch(9), .operation = Command::TransportControl::ResumeBodyDeliveryUpTo { .byte_count = 4096 } });++ Vector<u64> seen_ids;+ for (auto& command : commands) {+ command.visit(+ [&](Command::StartFetch const& start) {+ EXPECT_EQ(start.input.body_intent, BodyIntent::DrainAndDiscard);+ EXPECT(!start.input.blob_url_entry.has_value());+ seen_ids.append(start.input.fetch_id.value());+ },+ [&](Command::Abort const& abort) { seen_ids.append(abort.fetch_id.value()); },+ [&](Command::Terminate const& terminate) { seen_ids.append(terminate.fetch_id.value()); },+ [&](Command::Stop const& stop) { seen_ids.append(stop.fetch_id.value()); },+ [&](Command::ResolveRedirect const& resolve) {+ EXPECT(resolve.resolution.has<Command::ResolveRedirect::AcceptAsFinal>());+ EXPECT_EQ(resolve.continuation_id, ContinuationId(6));+ seen_ids.append(resolve.delivery_id.value());+ },+ [&](Command::PreloadResponseResolved const& preload) {+ auto const& completed = preload.response.outcome.get<Command::CompletedPreloadResponse::Completed>();+ EXPECT_EQ(completed.body.handle().bytes(), "preloaded"sv.bytes());+ seen_ids.append(preload.fetch_id.value());+ },+ [&](Command::TransportControl const& control) {+ EXPECT_EQ(control.transport_epoch, TransportEpoch(9));+ EXPECT_EQ(control.operation.get<Command::TransportControl::ResumeBodyDeliveryUpTo>().byte_count, 4096u);+ seen_ids.append(control.request_id.value());+ },+ [&](Command::AdoptNetworkTransport const&) { FAIL("no transport was posted"); });+ }+ EXPECT_EQ(seen_ids, (Vector<u64> { 1, 2, 3, 4, 5, 7, 8 }));+}++static bool peer_has_hung_up(IPC::Transport& transport)+{+ return transport.read_as_many_messages_as_possible_without_blocking([](auto&&) { }) == IPC::Transport::ShouldShutdown::Yes;+}++static void wait_for_peer_to_hang_up(IPC::Transport& transport)+{+ while (!peer_has_hung_up(transport))+ transport.wait_until_readable();+}++TEST_CASE(adopt_network_transport_owns_its_handle)+{+ auto pair = MUST(IPC::Transport::create_paired());++ Optional<EngineCommand> command = Command::AdoptNetworkTransport { .handle = move(pair.remote_handle) };+ EXPECT(!peer_has_hung_up(*pair.local));++ // The moved-to command alone owns the handle.+ EngineCommand moved = command.release_value();+ EXPECT(!peer_has_hung_up(*pair.local));++ moved = Command::Stop { .fetch_id = FetchId(1) };+ wait_for_peer_to_hang_up(*pair.local);+}++TEST_CASE(delivered_body_requires_a_valid_handle)+{+ EXPECT_DEATH("a delivered body is never null", (void)Delivered<NonNullLocalBodyHandle> { Core::ImmutableBytes {} });+}++TEST_CASE(events_round_trip_their_payloads)+{+ FetchTimingSeed timing_seed;+ timing_seed.start_time = 12.5;+ timing_seed.render_blocking = true;++ Vector<EngineEvent> events;+ events.append(Event::ResponseDelivery { .delivery_id = DeliveryId(1), .body = NullBody {}, .timing_seed = move(timing_seed) });+ events.append(Event::EndOfBody { .delivery_id = DeliveryId(2), .final_sizes = { .encoded_body_size = 10, .decoded_body_size = 20 }, .end_time = 99 });+ events.append(Event::ConsumeBodyResult { .delivery_id = DeliveryId(3), .outcome = Event::ConsumeBodyResult::Bytes { Core::ImmutableBytes::adopt(MUST(ByteBuffer::copy("body"sv.bytes()))) } });+ events.append(Event::BodyChannelReadable { .delivery_id = DeliveryId(4), .ticket = WakeTicket(7) });+ events.append(Event::DeliveryEnd { .delivery_id = DeliveryId(5), .outcome = Event::DeliveryEnd::Revoked {} });+ events.append(Event::RequestTransmissionStarted { .transmission_id = TransmissionId(6), .generation = TransmissionGeneration(1) });+ events.append(Event::RequestTransmissionEnded {+ .transmission_id = TransmissionId(7),+ .generation = TransmissionGeneration(2),+ .request_end = {+ .request_id = RequestId(70),+ .transport_epoch = TransportEpoch(3),+ .transport_complete_at = MonotonicTime::now(),+ .outcome = RequestEnd::CommittedAttemptFailed { .attempt_id = AttemptId(4), .error = Requests::NetworkError::IncompleteContent, .encoded_body_size = 512 },+ },+ });++ Vector<u64> seen_ids;+ for (auto const& event : events) {+ event.visit(+ [&](Event::ResponseDelivery const& delivery) {+ EXPECT(delivery.body.has<NullBody>());+ EXPECT_EQ(delivery.timing_seed.start_time, 12.5);+ EXPECT(delivery.timing_seed.render_blocking);+ seen_ids.append(delivery.delivery_id.value());+ },+ [&](Event::EndOfBody const& end) {+ EXPECT_EQ(end.final_sizes.decoded_body_size, 20u);+ seen_ids.append(end.delivery_id.value());+ },+ [&](Event::ConsumeBodyResult const& result) {+ EXPECT_EQ(result.outcome.get<Event::ConsumeBodyResult::Bytes>().bytes.bytes(), "body"sv.bytes());+ seen_ids.append(result.delivery_id.value());+ },+ [&](Event::BodyChannelReadable const& readable) {+ EXPECT_EQ(readable.ticket, WakeTicket(7));+ seen_ids.append(readable.delivery_id.value());+ },+ [&](Event::DeliveryEnd const& delivery_end) {+ EXPECT(delivery_end.outcome.has<Event::DeliveryEnd::Revoked>());+ seen_ids.append(delivery_end.delivery_id.value());+ },+ [&](Event::RequestTransmissionStarted const& started) { seen_ids.append(started.transmission_id.value()); },+ [&](Event::RequestTransmissionEnded const& ended) {+ EXPECT_EQ(ended.request_end.request_id, RequestId(70));+ auto const& failed = ended.request_end.outcome.get<RequestEnd::CommittedAttemptFailed>();+ EXPECT_EQ(failed.error, Requests::NetworkError::IncompleteContent);+ EXPECT_EQ(failed.encoded_body_size, 512u);+ seen_ids.append(ended.transmission_id.value());+ });+ }+ EXPECT_EQ(seen_ids, (Vector<u64> { 1, 2, 3, 4, 5, 6, 7 }));+}