Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bc7a9e0619dd06c2f3332aaf5ca1ea1e612640d2
      
https://github.com/WebKit/WebKit/commit/bc7a9e0619dd06c2f3332aaf5ca1ea1e612640d2
  Author: Ian Gower <[email protected]>
  Date:   2026-08-28 (Fri, 28 Aug 2026)

  Changed paths:
    M Source/WebCore/platform/WebCorePersistentCoders.cpp
    M Source/WebCore/platform/network/ResourceResponseBase.cpp
    M Source/WebCore/platform/network/ResourceResponseBase.h
    M Source/WebKit/NetworkProcess/cache/NetworkCache.cpp
    M Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h
    M Tools/TestWebKitAPI/Tests/WebCore/IPAddressSpaceTests.cpp

  Log Message:
  -----------
  Persist the resolved IP address space with a cached response
https://bugs.webkit.org/show_bug.cgi?id=322661
rdar://185933660

Reviewed by Chris Dumez.

Part of the Local Network Access implementation, 
https://wicg.github.io/local-network-access/ - the
check compares the address space a connection resolved to against the client's, 
so that space has to
survive being written to the network cache.

ResourceResponse carries the address space the connection resolved to, but it 
was dropped on the way
to disk: neither persistence coder encoded it, and the ResourceResponseData 
decoder hardcoded
IPAddressSpace::Unknown. A response read back from the network cache therefore 
lost the space its
connection had originally resolved to.

Both coders now encode and decode it, and EnumTraitsForPersistence is declared 
for IPAddressSpace so
the enum can be persisted at all. The cache version is bumped, since existing 
entries were written
without the field and cannot be read back with it.

Cache::update() takes the space from the validating response rather than 
keeping the stored one. The
body is reused on a 304, but the resource is being served now from the 
validating connection, and a
host that has since moved to a local address must not be reachable on the 
address space it used to
have.

Two tests cover the coders separately, across all four enum values. Reverting 
either coder fails only
its own test.

* Source/WebCore/platform/WebCorePersistentCoders.cpp:
(WTF::Persistence::Coder<WebCore::ResourceResponse>::encodeForPersistence):
(WTF::Persistence::Coder<WebCore::ResourceResponse>::decodeForPersistence):
* Source/WebCore/platform/network/ResourceResponseBase.cpp:
(WTF::Persistence::Coder<WebCore::ResourceResponseData>::encodeForPersistence):
(WTF::Persistence::Coder<WebCore::ResourceResponseData>::decodeForPersistence):
* Source/WebCore/platform/network/ResourceResponseBase.h:
* Source/WebKit/NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::update):
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.h:
* Tools/TestWebKitAPI/Tests/WebCore/IPAddressSpaceTests.cpp:

Canonical link: https://commits.webkit.org/320077@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to