Skip to content
7 changes: 5 additions & 2 deletions Common/Net/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ int Client::SendRequestWithData(const char *method, const RequestParams &req, co
return 0;
}

int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &responseHeaders, net::RequestProgress *progress) {
int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &responseHeaders, net::RequestProgress *progress, std::string *statusLine) {
// Snarf all the data we can into RAM. A little unsafe but hey.
static constexpr float CANCEL_INTERVAL = 0.25f;
bool ready = false;
Expand Down Expand Up @@ -421,6 +421,9 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &
return -1;
}

if (statusLine)
*statusLine = line;

while (true) {
int sz = readbuf->TakeLineCRLF(&line);
if (!sz || sz < 0)
Expand Down Expand Up @@ -553,7 +556,7 @@ int HTTPRequest::Perform(const std::string &url) {
}

if (!client.Connect(2, 20.0, &cancelled_)) {
ERROR_LOG(Log::HTTP, "Failed connecting to server or cancelled.");
ERROR_LOG(Log::HTTP, "Failed connecting to server or cancelled (=%d).", cancelled_);
return -1;
}

Expand Down
7 changes: 6 additions & 1 deletion Common/Net/HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Client : public net::Connection {

int SendRequest(const char *method, const RequestParams &req, const char *otherHeaders, net::RequestProgress *progress);
int SendRequestWithData(const char *method, const RequestParams &req, const std::string &data, const char *otherHeaders, net::RequestProgress *progress);
int ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &responseHeaders, net::RequestProgress *progress);
int ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &responseHeaders, net::RequestProgress *progress, std::string *statusLine = nullptr);
// If your response contains a response, you must read it.
int ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::string> &responseHeaders, Buffer *output, net::RequestProgress *progress);

Expand All @@ -83,7 +83,12 @@ class Client : public net::Connection {
userAgent_ = value;
}

void SetHttpVersion(const char *version) {
httpVersion_ = version;
}

protected:
std::string httpVersion_;
std::string userAgent_;
double dataTimeout_ = 900.0;
};
Expand Down
15 changes: 15 additions & 0 deletions Core/HLE/FunctionWrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ template<int func(u32, u32, u32, u32, u32)> void WrapI_UUUUU() {
RETURN(retval);
}

template<int func(u32, const char*, u32, u32, int)> void WrapI_UCUUI() {
int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
RETURN(retval);
}

template<int func(u32, int, const char*, u32, u32)> void WrapI_UICUU() {
int retval = func(PARAM(0), PARAM(1), Memory::GetCharPointer(PARAM(2)), PARAM(3), PARAM(4));
RETURN(retval);
}

template<int func()> void WrapI_V() {
int retval = func();
RETURN(retval);
Expand Down Expand Up @@ -785,6 +795,11 @@ template<u32 func(u32, u32, u32, u32, u32, u32, u32)> void WrapU_UUUUUUU() {
RETURN(retval);
}

template<int func(u32, u32, u32, u32, u32, u32, u32)> void WrapI_UUUUUUU() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
RETURN(retval);
}

template<int func(int, u32, u32, u32, u32, u32, u32)> void WrapI_IUUUUUU() {
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
RETURN(retval);
Expand Down
Loading