Fixed explicit initialization and constructor for HttpContext

This commit is contained in:
archshift 2015-05-12 21:56:57 -07:00
parent 5b12f23365
commit b550a4e4dc
2 changed files with 14 additions and 2 deletions

View File

@ -24,6 +24,16 @@ static int BufWriter(u8 *data, size_t size, size_t nmemb, std::vector<u8>* out_b
return static_cast<int>(size * nmemb);
}
HttpContext::HttpContext() {
state = REQUEST_STATE_NONE;
cancel_request = false;
req_type = REQUEST_TYPE_NONE;
request_hdrs = nullptr;
response_code = 0;
content_length = 0.0;
downloaded_size = 0.0;
}
HttpContext::~HttpContext() {
curl_slist_free_all(request_hdrs);
}
@ -68,8 +78,8 @@ void MakeRequest(HttpContext* context) {
mres = curl_multi_add_handle(manager, connection);
int still_running;
int repeats;
int still_running = 0;
int repeats = 0;
mres = curl_multi_perform(manager, &still_running);
do {

View File

@ -34,6 +34,7 @@ enum RequestType : u32 {
/// Current state of the HTTP request (API-exposed).
enum RequestState : u32 {
REQUEST_STATE_NONE = 0, // TODO: Verify
REQUEST_STATE_IN_PROGRESS = 5,
REQUEST_STATE_READY = 8,
};
@ -63,6 +64,7 @@ struct HttpContext {
double content_length; //< The total size in bytes that will be downloaded this request.
double downloaded_size; //< The amount in bytes that has been downloaded so far.
HttpContext();
~HttpContext();
};