Skip to content

feat(libSceHttp2): implement request option getters, header removal a… - #10536

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
noamroger:claude/project-thread-3146bi
Oct 27, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
noamroger:claude/project-thread-3146bi

Conversation

@noamroger

@noamroger noamroger commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Implements seven pending libSceHttp2 exports on top of the merged transport: sceHttp2RemoveRequestHeader, sceHttp2GetAuthEnabled, sceHttp2GetAutoRedirect, sceHttp2AuthCacheFlush, sceHttp2RedirectCacheFlush, sceHttp2SetAuthInfoCallback and sceHttp2SetPreSendCallback.

  • All state lives in Http2::Settings: redirect becomes an int (the stored value is read back unchanged), and the auth-info and pre-send callbacks are added there, so sceHttp2CreateRequestWithURL copies them with the rest and they freeze once transport exists. The transport never calls them.
  • Update() can now return the invalid-id error for contexts and cookie boxes, and propagate an error from its update; the option, header and callback calls use that. Other setters keep throwing for those kinds.
  • Http2::AddHeader returns 0x817B11FE for a null name or value (after removing the name in mode 0); sceHttp2AddRequestHeader checks the mode and then Connection (0x804311FE) before the id.
  • sceHttp2RemoveRequestHeader returns 0x817B1025 for a null or missing name; the getters read the settings even after send; sceHttp2AuthCacheFlush validates the context; sceHttp2RedirectCacheFlush ignores its argument (listed under Silent stubs).
  • Kinds, defaults, copying, modes, error codes and their order follow the 13.42 module results posted in this PR's review. The one deviation is a null pointer to sceHttp2GetAuthEnabled, which throws instead of writing through it. The pending-export count in the debt file drops from 12 to 5.

Tested

Linux (Ubuntu, GCC), full build: ctest --test-dir build -R guest_http2 passes (guest_http2, guest_http2_cookies, guest_http2_options, guest_http2_transport, guest_http2_early_response). guest_http2_options covers a request created after a template change and the immutable-after-send case. python3 tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py cannot run in my environment; open PRs touching libSceHttp2 were checked by hand (#9598, #11145 and #11470 already conflict with main, and none implements these exports).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (feat(http2): add synchronous HTTP/2 transport over TLS #10167 and feat(libSceHttp2): store cookies in cookie boxes #10534 are merged; this PR is rebased onto them)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

Generated with Claude Code

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Progress report (e61a7c7 → bffc7ed)

📈 System libraries: 51.46% (+0.03%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceHttp2 sceHttp2AuthCacheFlush
libSceHttp2 sceHttp2GetAuthEnabled
libSceHttp2 sceHttp2GetAutoRedirect
libSceHttp2 sceHttp2RedirectCacheFlush
⚪ 1 behaviourally empty (constant return or throw)
Library Name
libSceHttp2 sceHttp2RedirectCacheFlush

Changed libraries (implemented exports)

Library Before After Change
libSceHttp2 12/62 (19.35%) 16/62 (25.81%) +6.45 pp

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 11611 docs/dev/debt/libSceHttp2.md L15-16
PR 11616 docs/dev/debt/libSceHttp2.md L15
PR 11617 docs/dev/debt/libSceHttp2.md L15
PR 11630 core/libs/prx/libSceHttp2/Export.cpp L14-15
core/libs/prx/libSceHttp2/include/Http2.hpp L27

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 11134 core/libs/prx/libSceHttp2/Transport.cpp
docs/dev/debt/libSceHttp2.md
PR 11470 core/libs/prx/libSceHttp2/CMakeLists.txt
core/libs/prx/libSceHttp2/Export.cpp
core/libs/tests/GuestHttp2.cpp
docs/dev/debt/libSceHttp2.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlaps #10167 in core/libs/prx/libSceHttp2/Export.cpp, and #10167 is an open transport rewrite that replaces this file. The repository contribution rules require authors of overlapping PRs to agree on order and record the prerequisite with Depends on. The checklist currently says Depends on: none, and the PR description only notes the textual conflict. Please coordinate with #10167’s author and update the dependency/order in the checklist before merge; otherwise the combined result has not been reviewed or validated.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 24, 2026
@BunnyFl

BunnyFl commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

I checked these calls against the libSceHttp2 module from PS5 firmware 13.42 (run in an emulator from the module's init through the real sceHttp2Init, sceHttp2CreateTemplate and sceHttp2CreateRequestWithURL; none of the calls below go to the network or a system service, or check the SDK version). Results at head e18e4c6:

Matches the PR

  • Both flags default to enabled on a template and on a request. A request copies the template's flags, headers and both callbacks when it is created; later changes to the template don't reach existing requests, and changes to a request don't reach the template.
  • Mode 0 replaces every header of that name, mode 1 appends; names compare case-insensitively.
  • sceHttp2GetAuthEnabled returns 0 or 1 (7 reads back as 1). Both getters write 4 bytes; sceHttp2AuthCacheFlush takes one id; both callback setters take (id, callback, arg) and accept null for both.
  • sceHttp2AuthCacheFlush accepts only a context id: template, request, unknown and terminated ids return 0x817B1100.
  • Unknown and deleted ids (0, -1, 0x7fffffff, a deleted request) return 0x817B1100 from the setters, getters, header calls and callback setters.

Differs from the PR

  1. Accepted kinds: the setters, getters, header calls and callback setters accept only template and request ids (WebSocket requests count as requests). A context id or a cookie box id returns 0x817B1100; the PR accepts any live handle.
  2. sceHttp2RedirectCacheFlush never checks its argument: it returns 0 for any value, including template/request ids, unknown ids and before sceHttp2Init. The test expects 0x817B1100 for the request and for the invalid ids.
  3. sceHttp2RemoveRequestHeader: a name that isn't present returns 0x817B1025 (the test expects 0 for "absent"). A null name also returns 0x817B1025, checked before the id.
  4. sceHttp2AddRequestHeader:
    • a mode other than 0 or 1 returns 0x817B11FE, checked before the name and the id;
    • the name Connection (any case) returns 0x804311FE before the id check, and nothing is stored;
    • a null name or value returns 0x817B11FE after the id check. With mode 0, an existing header of that name has already been removed by then.
  5. Null out-pointers:
    • sceHttp2GetAutoRedirect(valid id, null) returns 0x817B11FE;
    • sceHttp2GetAuthEnabled has no null check: it writes through the pointer;
    • an unknown id returns 0x817B1100 first in both getters.
  6. sceHttp2GetAutoRedirect returns the stored int unchanged: SetAutoRedirect(id, 7) reads back 7 and -1 reads back -1. The PR stores a bool, so it reads back 1.

I didn't check what the flags, headers or callbacks do once a request is sent.

@noamroger
noamroger force-pushed the claude/project-thread-3146bi branch from e18e4c6 to 21cd89f Compare October 25, 2026 13:18
@noamroger

Copy link
Copy Markdown
Contributor Author

Thanks a lot for checking against the 13.42 module. All six differences are fixed in the latest push: option, header and callback calls accept only templates and requests; RedirectCacheFlush ignores its argument; RemoveRequestHeader returns 0x817B1025 for a missing or null name (checked first); AddRequestHeader checks the mode, then Connection, then the id, removes before the null check in mode 0, and returns 0x817B11FE / 0x804311FE as measured; GetAutoRedirect returns 0x817B11FE for a null pointer and stores the int unchanged. The one deviation is a null pointer to GetAuthEnabled, which throws instead of writing through it; it’s recorded in the debt file with a link to your review.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 25, 2026
@wachi35676

Copy link
Copy Markdown
Contributor

Tested head 21cd89f826 merged onto main 14eb2cda22 on Windows 11 (WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON). This adds the Windows run to the Linux one in the description.

  • The tree configures with the new test registration, and guest_http2_options build and pass 3 of 3 runs on Windows.
  • Negative control: with the libSceHttp2 sources from main the test does not build (new option getters missing), and the PR-head test binary against main's library fails (exit 0xc0000409).

AI-assisted: yes (Claude Code); results above were run on this machine.

@noamroger

Copy link
Copy Markdown
Contributor Author

Thanks for the Windows run and the negative control!

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 26, 2026
@adriadam10 adriadam10 self-assigned this Oct 26, 2026

@adriadam10 adriadam10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10167 has merged and this PR now conflicts with main in CMakeLists.txt, Export.cpp, Http2.hpp and docs/dev/debt/libSceHttp2.md. The textual conflicts are the smaller part; the design needs an author decision:

  • Http2::Settings (Transport.hpp) already stores headers, auth and redirect, and Http2::AddHeader and Update() in Export.cpp already implement sceHttp2AddRequestHeader, sceHttp2SetAuthEnabled and sceHttp2SetAutoRedirect. The new authEnabled, autoRedirect and headers fields on Http2Handle duplicate that state, and the template-to-request copy is already done through handle.settings = parent->settings in sceHttp2CreateRequestWithURL.
  • The semantics you measured on 13.42 differ from what main now does: setters accept any int for redirect (main throws unless it is 0 or 1), mode/Connection/id check order and error codes, and Remove/Get on kinds other than templates and requests. Please move the measured behaviour into Update() and Http2::AddHeader, and implement sceHttp2RemoveRequestHeader, sceHttp2GetAuthEnabled and sceHttp2GetAutoRedirect on Settings, keeping the rule that settings are immutable once transport exists (Update() currently throws then; decide what the getters and Remove do in that case).
  • Keep the auth-info and pre-send callbacks in Settings so they are copied with the rest. Say in the debt file that the transport never calls them, and state which of the two now-merged debt entries ("TLS settings", "transport") they extend.
  • Rebase onto main, keep guest_http2_cookies, guest_http2_transport and guest_http2_early_response in CMakeLists.txt next to guest_http2_options, and extend the guest_http2_options test to cover a request created after a template change and the immutable-after-send case.
  • Update the "pending exports" count in the debt file (12 on main now, minus the seven you implement).

Thanks to BunnyFl and wachi35676 for the 13.42 and Windows runs; their results still apply once the code sits on Settings.

…nd callbacks

Keep the auth and auto-redirect flags, headers and the auth-info and
pre-send callbacks in Http2::Settings, so requests copy them from their
template and they freeze once transport exists. Accepted kinds, error
codes and their order follow the firmware 13.42 module as reported in
the review: option, header and callback calls reject contexts and
cookie boxes, sceHttp2AuthCacheFlush validates the context,
sceHttp2RedirectCacheFlush ignores its argument and the auto-redirect
flag keeps the stored int.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QdXm6rjuENJGYLZh5hc8cQ
@noamroger
noamroger force-pushed the claude/project-thread-3146bi branch from 21cd89f to bffc7ed Compare October 26, 2026 20:54
@noamroger

Copy link
Copy Markdown
Contributor Author

Thanks, done in bffc7ed, rebased onto main. All state is in Http2::Settings (redirect is now an int, the two callbacks are added there and copied with the rest); Update() returns the invalid-id error for other kinds and propagates AddHeader/Remove errors for these calls, and still throws once transport exists. The getters read the settings even after send. The debt entry now extends "TLS settings", says the transport never calls the callbacks, and the pending count is 5. guest_http2_options covers a request created after a template change and the immutable-after-send case.

@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 26, 2026 20:58

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 26, 2026
@adriadam10
adriadam10 merged commit 9165e87 into boykopovar:main Oct 27, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the re-review points against bffc7ed: auth, redirect, headers and both callbacks now live in Http2::Settings and are copied with the rest, Update()/AddHeader carry the measured behaviour, the getters read after send, guest_http2_options covers a request created after a template change and the immutable-after-send case, and the debt entries and pending count (5) are correct; merged.

sherySJ added a commit to sherySJ/AnyPS5 that referenced this pull request Nov 4, 2026
Old: "automatic redirects throw, so there is no redirect cache to flush"
New: "redirects are followed without a cache, so there is nothing to
flush"

Evidence:
- core/libs/prx/libSceHttp2/Transport.cpp:947-1023 loops over 301, 302,
  303, 307 and 308 responses, calls the redirect callback and stops
  after six redirects.
- core/libs/prx/libSceHttp2/Transport.hpp:33 has `int redirect = 1;`,
  so following is the default.
- core/libs/prx/libSceHttp2/Export.cpp:465-468
  sceHttp2RedirectCacheFlush still returns 0 without a cache, so the
  rest of the entry is unchanged.
- bffc7ed (boykopovar#10536) wrote the old clause while the transport rejected
  redirects. 59bc5a8 (boykopovar#11586) made the transport follow them and
  removed the matching transport entry but missed this line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants