mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
Merge pull request #555 from Phi1ow/implement-http-request2-ssl-options
feat(http): implement sceHttpCreateRequest2, sceHttpsEnableOption, sceHttpsLoadCert and sceHttpGetLastErrno
This commit is contained in:
@@ -257,4 +257,36 @@ int APS5_VABI sceHttpUnknown01(void) {
|
||||
NotImplemented_nid_no_patch("vO4B-42ef-k");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceHttpCreateRequest2(int conn_id, const char* method, const char* path, uint64_t content_length) {
|
||||
(void)conn_id;
|
||||
(void)method;
|
||||
(void)path;
|
||||
(void)content_length;
|
||||
return g_nextHandle.fetch_add(1, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
int APS5_VABI sceHttpsEnableOption(int id, uint32_t ssl_flags) {
|
||||
(void)id;
|
||||
(void)ssl_flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceHttpsLoadCert(int http_ctx_id, int num, void* ca_list, void* cert, void* key) {
|
||||
(void)http_ctx_id;
|
||||
(void)num;
|
||||
(void)ca_list;
|
||||
(void)cert;
|
||||
(void)key;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceHttpGetLastErrno(int request_id, int* errno_out) {
|
||||
(void)request_id;
|
||||
if (errno_out == nullptr) {
|
||||
return ERROR_INVALID_VALUE;
|
||||
}
|
||||
*errno_out = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ int APS5_VABI sceHttpUriEscape(char*, std::size_t*, std::size_t, const char*);
|
||||
int APS5_VABI sceHttpCreateEpoll(int, HttpEpollHandle*);
|
||||
int APS5_VABI sceHttpDestroyEpoll(int, HttpEpollHandle);
|
||||
int APS5_VABI sceHttpReadData(int, void*, std::size_t);
|
||||
int APS5_VABI sceHttpCreateRequest2(int, const char*, const char*, std::uint64_t);
|
||||
int APS5_VABI sceHttpsEnableOption(int, std::uint32_t);
|
||||
int APS5_VABI sceHttpsLoadCert(int, int, void*, void*, void*);
|
||||
int APS5_VABI sceHttpGetLastErrno(int, int*);
|
||||
}
|
||||
|
||||
static void Require(bool value) { if (!value) std::abort(); }
|
||||
@@ -91,4 +95,12 @@ int main() {
|
||||
|
||||
char data[16];
|
||||
Require(sceHttpReadData(1, data, sizeof(data)) == network);
|
||||
|
||||
Require(sceHttpCreateRequest2(1, "GET", "/", 0) > 0);
|
||||
Require(sceHttpsEnableOption(1, 0) == 0);
|
||||
Require(sceHttpsLoadCert(1, 0, nullptr, nullptr, nullptr) == 0);
|
||||
int httpErrno = -1;
|
||||
Require(sceHttpGetLastErrno(1, &httpErrno) == 0);
|
||||
Require(httpErrno == 0);
|
||||
Require(sceHttpGetLastErrno(1, nullptr) == invalidValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user