Skip to content

Truly independent web browser

LibWeb+LibHTTP+LibRequests: Correct what body transport comments say

Luke Wilde60ef32d8eec6
diff --git a/Libraries/LibHTTP/Cache/MemoryCache.h b/Libraries/LibHTTP/Cache/MemoryCache.h
index c647db2efa2..1361148f45c 100644
--- a/Libraries/LibHTTP/Cache/MemoryCache.h
+++ b/Libraries/LibHTTP/Cache/MemoryCache.h
@@ -41,7 +41,8 @@ public:
void create_entry(URL::URL const&, StringView method, HeaderList const& request_headers, UnixDateTime request_time, u32 status_code, ByteString reason_phrase, HeaderList const& response_headers, Optional<Core::ImmutableBytes> javascript_bytecode_cache = {}, Optional<u64> javascript_bytecode_cache_vary_key = {});
void finalize_entry(URL::URL const&, StringView method, HeaderList const& request_headers, u32 status_code, HeaderList const& response_headers, Core::ImmutableBytes response_body);
- // Drops the entry create_entry() made for a response whose body will not be finalized.
+ // Drops the oldest pending entry with the request's cache and vary keys, for a response whose body will not be
+ // finalized.
void abandon_entry(URL::URL const&, StringView method, HeaderList const& request_headers, HeaderList const& response_headers);
void update_javascript_bytecode_cache(URL::URL const&, StringView method, HeaderList const& request_headers, u64 vary_key, Core::ImmutableBytes javascript_bytecode_cache);
diff --git a/Libraries/LibRequests/Request.h b/Libraries/LibRequests/Request.h
index 05d75d51064..fb50da3b57b 100644
--- a/Libraries/LibRequests/Request.h
+++ b/Libraries/LibRequests/Request.h
@@ -28,7 +28,7 @@ class RequestClient;
class ResponseData {
public:
- // A slice of a whole mapped body.
+ // A slice of a whole body, delivered with that whole body.
struct FileBackedSlice {
Core::ImmutableBytes slice;
Core::ImmutableBytes payload;
diff --git a/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.cpp b/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.cpp
index 5b7e57ddb54..ac0ec3aeed1 100644
--- a/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.cpp
+++ b/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.cpp
@@ -110,7 +110,8 @@ FetchByteChannel::WriteResult FetchByteChannel::write_bytes(Variant<Core::Immuta
if (m_transport_ended) {
notifications.append(Misbehaved { "The transport delivered after ending the body"sv });
} else if (!m_state.has<Open>()) {
- // The consumer cancelled and the transport has not heard yet.
+ // Before the transport ends the body, a write after a cancellation or a transfer is rejected without a
+ // misbehaved() report.
} else if (size > m_outstanding_transport_credit) {
notifications.append(Misbehaved { "The transport delivered more than it was granted"sv });
} else {
diff --git a/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.h b/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.h
index 61548ae5e1b..7922250704e 100644
--- a/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.h
+++ b/Libraries/LibWeb/Fetch/Engine/FetchByteChannel.h
@@ -37,7 +37,7 @@ public:
virtual void consumer_cancelled() = 0;
- // Called for a delivery no honest transport could have made.
+ // Called for a delivery or an ending no honest transport could have made.
virtual void misbehaved(StringView reason);
};
@@ -125,8 +125,8 @@ public:
};
using WakeOn = Variant<BufferedAtLeast, EndOnly, PrefixOf>;
- // Each call adds a waiter that fires once, and returns the ticket its wake will carry; a wake already due fires
- // before this returns, outside the lock. Waiters due at the same time fire in the order they were added.
+ // Each call adds a waiter that fires at most once, and returns the ticket its wake will carry; a wake already due
+ // fires before this returns, outside the lock. Waiters due at the same time fire in the order they were added.
WakeTicket arm_waiter(WakeOn = BufferedAtLeast { 1 });
void disarm_waiter(WakeTicket);
diff --git a/Libraries/LibWeb/Fetch/Fetching/NetworkBodyPump.h b/Libraries/LibWeb/Fetch/Fetching/NetworkBodyPump.h
index 1e6c4b165bc..1b7c477ae5a 100644
--- a/Libraries/LibWeb/Fetch/Fetching/NetworkBodyPump.h
+++ b/Libraries/LibWeb/Fetch/Fetching/NetworkBodyPump.h
@@ -37,7 +37,7 @@ public:
void handle_network_error(StringView error_message);
void set_cached_response_body(Core::ImmutableBytes);
- // Drops the response's pending memory-cache entry, for a body that will not finish arriving.
+ // Drops a pending memory-cache entry that matches the response's request, for a body that will not finish arriving.
void abandon_cache_entry();
private: