Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions core/libs/prx/libSceHttp/Export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,11 +819,6 @@ int APS5_VABI sceHttpSetSocketCreationCallback(std::int32_t id, HttpSocketCreati
return 0;
}

int APS5_VABI sceHttpSetHttp09Enabled(int id, int enabled) {
NotImplemented_nid_no_patch(__func__);
return 0;
}

int APS5_VABI sceHttpGetRegisteredCtxIds(int contextId, int* netPoolId, int* sslContextId) {
if (!netPoolId || !sslContextId) APS5_INVALID_ARG_EX;
std::lock_guard lock(g_stateMutex);
Expand All @@ -845,9 +840,4 @@ int APS5_VABI sceHttpAddQuery(int id, const char* query) {
return 0;
}

int APS5_VABI sceHttpSetDelayBuildRequestEnabled(int id, int enabled) {
NotImplemented_nid_no_patch(__func__);
return 0;
}

}
4 changes: 2 additions & 2 deletions core/libs/prx/libSceHttp/include/Http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ int APS5_VABI sceHttpRequestGetAllHeaders(int requestId, HttpRequestHeader* head
int APS5_VABI sceHttpSetDefaultAcceptEncodingGZIPEnabled(int httpCtxId, int enable);
int APS5_VABI sceHttpSetProxy(int id, int, int, const char* hostname, std::uint16_t);
int APS5_VABI sceHttpSetSocketCreationCallback(std::int32_t id, HttpSocketCreationCallback callback, void* userArg);
int APS5_VABI sceHttpSetHttp09Enabled(int id, int enabled);
int APS5_VABI sceHttpSetHttp09Enabled(int id, int enable);
int APS5_VABI sceHttpGetRegisteredCtxIds(int contextId, int* netPoolId, int* sslContextId);
int APS5_VABI sceHttpGetConnectionStat(std::int32_t connectionId, HttpConnectionStat* stat);
int APS5_VABI sceHttpAddQuery(int id, const char* query);
int APS5_VABI sceHttpSetDelayBuildRequestEnabled(int id, int enabled);
int APS5_VABI sceHttpSetDelayBuildRequestEnabled(int id, int enable);
int APS5_VABI sceHttpGetAutoRedirect(int id, int* enable);
int APS5_VABI sceHttpGetNonblock(int id, int* enable);
int APS5_VABI sceHttpTryGetNonblock(int id, int* enable);
Expand Down
12 changes: 12 additions & 0 deletions core/libs/prx/libSceHttp/src/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,18 @@ int APS5_VABI sceHttpCacheRedirectedConnectionEnabled(int id, int enable) {
return FindHttpOptions(id) ? 0 : ERROR_INVALID_ID;
}

int APS5_VABI sceHttpSetHttp09Enabled(int id, int enable) {
if (!HttpInitialised()) return ERROR_BEFORE_INIT;
(void)enable;
return FindHttpOptions(id) ? 0 : ERROR_INVALID_ID;
}

int APS5_VABI sceHttpSetDelayBuildRequestEnabled(int id, int enable) {
if (!HttpInitialised()) return ERROR_BEFORE_INIT;
(void)enable;
return FindHttpOptions(id) ? 0 : ERROR_INVALID_ID;
}

int APS5_VABI sceHttpsEnableOptionPrivate(int id, std::uint32_t sslFlags) {
if (!HttpInitialised()) return ERROR_BEFORE_INIT;
if ((sslFlags & ~PrivateSslFlags) != 0) return ERROR_INVALID_VALUE;
Expand Down
7 changes: 7 additions & 0 deletions core/libs/tests/GuestHttpOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void CheckTermEndsOptions() {
Require(sceHttpGetEpoll(connection, &bound, nullptr) == BeforeInit && sceHttpUnsetEpoll(connection) == BeforeInit, "the epoll binding outlived the last sceHttpTerm");
Require(sceHttpCacheRedirectedConnectionEnabled(connection, 1) == BeforeInit, "sceHttpCacheRedirectedConnectionEnabled works after the last sceHttpTerm");
Require(sceHttpSetProxy(connection, 1, 0, "proxy.example", 3128) == BeforeInit, "sceHttpSetProxy works after the last sceHttpTerm");
Require(sceHttpSetHttp09Enabled(connection, 1) == BeforeInit && sceHttpSetDelayBuildRequestEnabled(connection, 1) == BeforeInit, "the HTTP/0.9 and delayed request build options work after the last sceHttpTerm");
Require(sceHttpsEnableOptionPrivate(connection, 0x4000u) == BeforeInit && sceHttpsDisableOptionPrivate(connection, 0x4000u) == BeforeInit, "the private SSL options work after the last sceHttpTerm");
Require(sceHttpGetNonblock(connection, nullptr) == BeforeInit, "a null output is checked before initialisation");
Require(value == -1 && bound == nullptr, "a refused getter wrote its output");
Expand Down Expand Up @@ -203,6 +204,12 @@ void CheckUnobservedOptions(int context) {
Require(sceHttpRemoveRequestHeader(UnknownId, nullptr) == 0, "offline header removal started validating arguments");
Require(sceHttpCacheRedirectedConnectionEnabled(pattern, 0) == 0 && sceHttpCacheRedirectedConnectionEnabled(request, 1) == 0, "sceHttpCacheRedirectedConnectionEnabled refused a live object");
Require(sceHttpCacheRedirectedConnectionEnabled(UnknownId, 1) == InvalidId, "sceHttpCacheRedirectedConnectionEnabled took an unknown id");
for (const auto setter : {sceHttpSetHttp09Enabled, sceHttpSetDelayBuildRequestEnabled}) {
for (const int id : {pattern, connection, request}) {
Require(setter(id, 1) == 0 && setter(id, 0) == 0 && setter(id, -1) == 0 && setter(id, 7) == 0, "an offline option setter refused a live object");
}
Require(setter(UnknownId, 1) == InvalidId && setter(0, 1) == InvalidId, "an offline option setter took an unknown id");
}
for (const auto option : {sceHttpsEnableOptionPrivate, sceHttpsDisableOptionPrivate}) {
Require(option(connection, 0x2dffu) == 0 && option(connection, 0) == 0, "a private SSL option within the mask was refused");
Require(option(connection, 0x0100u) == 0 && option(connection, 0x2000u) == 0, "a private-only SSL flag was refused");
Expand Down
1 change: 1 addition & 0 deletions docs/dev/debt/libSceHttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [libSceHttp](../../../core/libs/prx/libSceHttp/Export.cpp) - no request reaches the network, so `sceHttpSetResponseHeaderMaxSize` has no response header to limit, `sceHttpSetRecvBlockSize` (`(int id, u32 blockSize)` as in [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/network/http.h)) no response body to read in blocks and `sceHttpRedirectCacheFlush` no redirect to forget; `sceHttpsUnloadCert` returns success like `sceHttpsLoadCert`, which keeps no certificate; `sceHttpSetRedirectCallback` and `sceHttpSetCookieRecvCallback` accept callbacks that are never called, `sceHttpsSetSslVersion` has no TLS connection to configure and `sceHttpsGetSslError` reports error 0 with detail 0; `sceHttpSetAuthInfoCallback` accepts a callback that is never called, as no server asks for authentication; `sceHttpsGetCaList` and `sceHttpsFreeCaList` report an empty CA list (`certs` null, `certsNum` 0) and return 0, as no CA store is kept, and a null list returns `ERROR_INVALID_VALUE`; unlike shadPS4 they do not check that `http_ctx_id` is a live context nor that the library is initialised, and `sceHttpsFreeCaList` also nulls `certs`, which shadPS4 leaves untouched. The signatures and the `{ void* certs; int certsNum; }` layout follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/network/http.h) (PS4), not confirmed on a PS5 title
- [HTTP options without a network](../../../core/libs/prx/libSceHttp/src/Options.cpp) (libSceHttp) - `sceHttpCacheRedirectedConnectionEnabled`, `sceHttpsEnableOptionPrivate` and `sceHttpsDisableOptionPrivate` return 0 for a live template, connection or request and keep nothing, since no request reaches the network; the private options refuse flags outside `0x2dff` with `ERROR_INVALID_VALUE` before they look at the id, and `sceHttpAbortRequestForce` does what `sceHttpAbortRequest` does. Signatures, the mask and the order of the checks follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/network/http.cpp) (PS4), not measured on a PS5
- [sceHttpSetHttp09Enabled, sceHttpSetDelayBuildRequestEnabled](../../../core/libs/prx/libSceHttp/src/Options.cpp) (libSceHttp) - return 0 for a live template, connection or request and keep nothing: HTTP/0.9 response parsing and delayed request building change nothing while no request reaches the network, and no getter reads them back. Any `enable` value is accepted; whether the console refuses values above 1, as `sceHttpSetCookieEnabled` does, is unverified. The signature `(int id, int enable)` follows [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/network/http.cpp#L1896-L1909) (PS4), which only logs and returns 0; the order of the checks (`BEFORE_INIT`, then `INVALID_ID`) follows the other option calls. Not measured on a PS5
- [sceHttpSetProxy](../../../core/libs/prx/libSceHttp/Export.cpp) (libSceHttp) - returns 0 for a live template, connection or request and keeps nothing, since no request reaches the network. The signature `(id, HTTP proxy conf, WLAN proxy conf, host, port)` and the order of the checks (`ERROR_BEFORE_INIT`, then `ERROR_INVALID_VALUE` for a null host, then `ERROR_INVALID_ID`) follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/network/http.cpp) (PS4), which stores the proxy; not measured on a PS5

### Unknown function info
Expand Down
Loading