mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-19 22:16:36 +00:00
Fix HTTP RequestState values (fixes Pretendo Network support with HLE http) (#143)
* Fix http RequestState values * Fix formatting
This commit is contained in:
parent
e15d4c0d4a
commit
de1f082e75
2 changed files with 28 additions and 10 deletions
|
@ -381,10 +381,10 @@ void Context::MakeRequestNonSSL(httplib::Request& request, const URLInfo& url_in
|
|||
|
||||
if (!client->send(request, response, error)) {
|
||||
LOG_ERROR(Service_HTTP, "Request failed: {}: {}", error, httplib::to_string(error));
|
||||
state = RequestState::TimedOut;
|
||||
state = RequestState::Completed;
|
||||
} else {
|
||||
LOG_DEBUG(Service_HTTP, "Request successful");
|
||||
state = RequestState::ReadyToDownloadContent;
|
||||
state = RequestState::ReceivingBody;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,10 +439,10 @@ void Context::MakeRequestSSL(httplib::Request& request, const URLInfo& url_info,
|
|||
|
||||
if (!client->send(request, response, error)) {
|
||||
LOG_ERROR(Service_HTTP, "Request failed: {}: {}", error, httplib::to_string(error));
|
||||
state = RequestState::TimedOut;
|
||||
state = RequestState::Completed;
|
||||
} else {
|
||||
LOG_DEBUG(Service_HTTP, "Request successful");
|
||||
state = RequestState::ReadyToDownloadContent;
|
||||
state = RequestState::ReceivingBody;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,6 +696,7 @@ void HTTP_C::ReceiveDataImpl(Kernel::HLERequestContext& ctx, bool timeout) {
|
|||
http_context.current_copied_data,
|
||||
0, remaining_data);
|
||||
http_context.current_copied_data += remaining_data;
|
||||
http_context.state = RequestState::Completed;
|
||||
rb.Push(ResultSuccess);
|
||||
} else {
|
||||
async_data->buffer->Write(http_context.response.body.data() +
|
||||
|
|
|
@ -48,12 +48,29 @@ enum class RequestMethod : u8 {
|
|||
constexpr u32 TotalRequestMethods = 8;
|
||||
|
||||
enum class RequestState : u8 {
|
||||
NotStarted = 0x1, // Request has not started yet.
|
||||
ConnectingToServer = 0x5, // Request in progress, connecting to server.
|
||||
SendingRequest = 0x6, // Request in progress, sending HTTP request.
|
||||
ReceivingResponse = 0x7, // Request in progress, receiving HTTP response.
|
||||
ReadyToDownloadContent = 0x8, // Ready to download the content.
|
||||
TimedOut = 0xA, // Request timed out?
|
||||
/// Request has not started yet.
|
||||
NotStarted = 0x1,
|
||||
|
||||
/// Request in progress, connecting to server.
|
||||
ConnectingToServer = 0x5,
|
||||
|
||||
/// Request in progress, sending HTTP request.
|
||||
SendingRequest = 0x6,
|
||||
|
||||
// Request in progress, receiving HTTP response and headers.
|
||||
ReceivingResponse = 0x7,
|
||||
|
||||
/// Request in progress, receiving HTTP body. The HTTP module may
|
||||
/// get stuck in this state if the internal receive buffer gets full.
|
||||
/// Once the user calls ReceiveData it will get unstuck.
|
||||
ReceivingBody = 0x8,
|
||||
|
||||
/// Request is finished and all data has been received. HTTP transitions
|
||||
/// to the Completed state shortly afterwards after some cleanup.
|
||||
Received = 0x9,
|
||||
|
||||
/// Request is completed.
|
||||
Completed = 0xA,
|
||||
};
|
||||
|
||||
enum class PostDataEncoding : u8 {
|
||||
|
|
Loading…
Reference in a new issue