Skip to content
Open
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
2 changes: 1 addition & 1 deletion core/libs/prx/libSceHttp/src/Curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class CurlTransport final : public ITransport {
curl_off_t sent = 0;
curl_easy_getinfo(easy, CURLINFO_SIZE_UPLOAD_T, &sent);
if (sent != uploaded) { uploaded = sent; progress = Clock::now(); }
const auto timeout = phase == 0 ? settings.resolveTimeout : phase == 1 ? settings.connectTimeout : static_cast<std::uint64_t>(uploaded) < payload.size() ? settings.sendTimeout : settings.receiveTimeout;
const auto timeout = ready ? settings.receiveTimeout : phase == 0 ? settings.resolveTimeout : phase == 1 ? settings.connectTimeout : static_cast<std::uint64_t>(uploaded) < payload.size() ? settings.sendTimeout : settings.receiveTimeout;
if (running && timeout != 0 && Clock::now() - progress >= std::chrono::microseconds(timeout)) {
code = CURLE_OPERATION_TIMEDOUT;
break;
Expand Down
9 changes: 9 additions & 0 deletions core/libs/tests/GuestHttpNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ int main(int argc, char** argv) {
Require(sceHttpSetRequestContentLength(post, payload.size()) == 0, "content length update");
Require(sceHttpSendRequest(post, payload.data(), payload.size()) == 0 && ReadBody(post) == payload, "POST echo");
Require(sceHttpDeleteRequest(post) == 0, "POST cleanup");
#ifdef __linux__
const auto earlyResponse = sceHttpCreateRequest(connection, 1, "/earlyresponse", payload.size());
Require(sceHttpAddRequestHeader(earlyResponse, "Expect", "100-continue", 0) == 0, "early response header setup");
Require(sceHttpSetSendTimeOut(earlyResponse, 0) == 0 && sceHttpSetRecvTimeOut(earlyResponse, 100000) == 0, "early response timeout setup");
Require(sceHttpSendRequest(earlyResponse, payload.data(), payload.size()) == 0, "early response send");
Require(sceHttpGetStatusCode(earlyResponse, &status) == 0 && status == 413, "early response status");
Require(sceHttpReadData(earlyResponse, small, sizeof(small)) == static_cast<int>(0x80431068u), "early response used upload deadline for receiving");
Require(sceHttpDeleteRequest(earlyResponse) == 0, "early response cleanup");
#endif
for (const auto code : {303, 307}) {
const auto path = "/post" + std::to_string(code);
const auto redirectedPost = sceHttpCreateRequest(connection, 1, path.c_str(), payload.size());
Expand Down
13 changes: 13 additions & 0 deletions core/libs/tests/http/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ def response(self, status, body, headers=()):
def do_HEAD(self):
self.do_GET()

def handle_expect_100(self):
if self.path != "/earlyresponse":
return super().handle_expect_100()
self.send_response(413)
self.send_header("Content-Length", "1")
self.send_header("Connection", "close")
self.end_headers()
self.wfile.flush()
self.close_connection = True
time.sleep(0.5)
self.wfile.write(b"x")
return False

def do_POST(self):
length = int(self.headers.get("Content-Length", "0"))
body = self.rfile.read(length)
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/debt/libSceHttp.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@

- [sceHttpAbortWaitRequest, sceHttpWaitRequest](../../../core/libs/prx/libSceHttp/Export.cpp) (libSceHttp) - the abort takes only the epoll handle, as in [Orbital](https://github.com/AlexAltea/orbital/blob/master/tools/ida/db_types.json) and [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/main/src/SharpProspero/Interop/Net/Http.cs); behaviour and error codes follow [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/main/src/core/libraries/network/http.cpp) (PS4), not confirmed on a PS5 title or hardware. An abort stays set: every later wait on the handle, a poll included, returns `SCE_HTTP_ERROR_ABORTED` (0x80431080) until the handle is destroyed. A wait woken by `sceHttpDestroyEpoll`, or by the `sceHttpTerm` that ends the last context, returns 0 events. The epoll calls return `BEFORE_INIT` (0x80431001) while no `sceHttpInit` context is alive and `INVALID_ID` (0x80431100) for an unknown context or handle, and `sceHttpTerm` returns the same errors instead of succeeding for any id. Handles are pointers, so a stale handle whose address a newer epoll reuses is taken as that epoll

- [Linux HTTP transport](../../../core/libs/prx/libSceHttp/src/Curl.cpp) - the response body is streamed through a 64 KiB host buffer. DNS, connect, upload and receive deadlines use host timing with 25 ms polling, not console measurements. DNS cancellation depends on the host resolver returning. The host CA bundle and curl/mbedTLS diagnostics replace the console trust store and errno details. Certificate callbacks apply the inherited TLS flag assumptions; certificate-loading APIs, nonblocking requests and guest callback dispatch remain unsupported. No title progression is established by loopback tests.
- [Linux HTTP transport](../../../core/libs/prx/libSceHttp/src/Curl.cpp) - the response body is streamed through a 64 KiB host buffer. DNS, connect, upload and receive deadlines use host timing with 25 ms polling, not console measurements. After final response headers arrive, the receive deadline applies even if the server rejected the upload before its body was sent. DNS cancellation depends on the host resolver returning. The host CA bundle and curl/mbedTLS diagnostics replace the console trust store and errno details. Certificate callbacks apply the inherited TLS flag assumptions; certificate-loading APIs, nonblocking requests and guest callback dispatch remain unsupported. No title progression is established by loopback tests.
Loading