feat(libSceNKWebKit): implement WebCore::parseCacheControlDirectives #16643
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16643"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-07T12:13:41Z.
What
Implements libSceNKWebKit
WebCore::parseCacheControlDirectives(const WebCore::HTTPHeaderMap&)(_ZN7WebCore27parseCacheControlDirectivesERKNS_13HTTPHeaderMapE, NIDkB7iRn6G2NQ), which threw throughNotImplemented_nid_no_patch.ResourceResponseBasecalls it for a response's cache-policy queries (ResourceResponseBase.cpp). It reads theHTTPHeaderMapthat #15326 implemented.Source:
Source/WebCore/platform/network/CacheValidation.cpplines 176–349 andCacheValidation.hlines 62–79, at the PS5 WebKit revision the NKWebKit debt file and earlier ports use (80f77e94).src/CacheControl.cppstarts with that file's notice, copied byte for byte. It follows upstream:Cache-Controlvalue has every character at or below' 'and DEL removed.parseCacheHeader): directives are split on commas. Quoted values run to the next quote, and an unterminated quote ends parsing. Names and unquoted values stop at the first cache-header separator.no-cachecounts only without a value;max-age,max-staleandstale-while-revalidatekeep their first valid value;max-staleis infinity;StringView::toDouble, so fractions and negatives are kept and trailing junk is rejected. This uses the existingWTF::charactersToDoubleexports for both character widths, whichtoDoublecalls upstream.Pragmafallback: whenno-cacheis still unset, it is set ifPragmacontainsno-cache, ignoring ASCII case.ABI, from
CacheValidation.h,Markable.h(lines 86–155) andSeconds.h(lines 223–240):CacheControlDirectivesholds threeMarkable<Seconds>, each a singledoublewith NaN meaning "unset" and no separate flag, at offsets 0, 8 and 16. The bit-fieldsnoCache,noStore,mustRevalidateandimmutableare bits 0–3 of byte 24. The struct is 32 bytes, aligned to 8 and trivially copyable.APS5_VABI). GCC 15's assembly for the export confirms this.src/CacheControlAbi.hppchecks size, alignment, offsets and triviality withstatic_asserts.b66ca0e85a).Tested
tests/CacheControl.cpp(nkwebkit_cachecontrol, registered by the NKWebKit tests glob). It builds header maps through the existingHTTPHeaderMapexports and checks every field and flag bit. Each of 36 cases runs with 8-bit and 16-bit header values, and there is an empty-map case. The cases cover:no-cachewith and without a value;max-stale;Pragma: no-cachewith and withoutCache-Control.main, 39/40 pass; the new test fails with_ZN7WebCore27parseCacheControlDirectivesERKNS_13HTTPHeaderMapE not implemented;public_headerspasses.max-ageandmax-staledestinations fails withgot 34 12 56for inputs 12, 34 and 56.nkwebkit_cachecontrol, with no warnings in the new files.python3 tools/check_conventions.py --base origin/main: all conventions checks passed.python3 tools/pr_overlap.py --branch feat/libscenkwebkit-parse-cache-control-directives: no open PR implements this export or works inCacheValidation. #15213 implemented a different function from that file and is merged.CookieUtil::defaultPathForURL). Whichever merges second recounts.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code