mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Cleanup, fix so we can run RetroAchievements with https, and start doing that
This commit is contained in:
parent
9decdd198e
commit
61db21b12d
5 changed files with 15 additions and 26 deletions
|
@ -96,14 +96,6 @@ public:
|
||||||
HTTPDownload(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile, ProgressBarMode progressBarMode = ProgressBarMode::DELAYED, const std::string &name = "");
|
HTTPDownload(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile, ProgressBarMode progressBarMode = ProgressBarMode::DELAYED, const std::string &name = "");
|
||||||
~HTTPDownload();
|
~HTTPDownload();
|
||||||
|
|
||||||
void SetAccept(const char *mime) override {
|
|
||||||
acceptMime_ = mime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUserAgent(const std::string &userAgent) override {
|
|
||||||
userAgent_ = userAgent;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start() override;
|
void Start() override;
|
||||||
void Join() override;
|
void Join() override;
|
||||||
|
|
||||||
|
@ -135,12 +127,10 @@ private:
|
||||||
|
|
||||||
RequestMethod method_;
|
RequestMethod method_;
|
||||||
std::string postData_;
|
std::string postData_;
|
||||||
std::string userAgent_;
|
|
||||||
Buffer buffer_;
|
Buffer buffer_;
|
||||||
std::vector<std::string> responseHeaders_;
|
std::vector<std::string> responseHeaders_;
|
||||||
Path outfile_;
|
Path outfile_;
|
||||||
std::thread thread_;
|
std::thread thread_;
|
||||||
const char *acceptMime_ = "*/*";
|
|
||||||
std::string postMime_;
|
std::string postMime_;
|
||||||
int resultCode_ = 0;
|
int resultCode_ = 0;
|
||||||
bool completed_ = false;
|
bool completed_ = false;
|
||||||
|
|
|
@ -110,8 +110,7 @@ bool HTTPSDownload::Done() {
|
||||||
|
|
||||||
completed_ = true;
|
completed_ = true;
|
||||||
|
|
||||||
if (callback_)
|
// The callback will be called later.
|
||||||
callback_(*this);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,6 @@ public:
|
||||||
HTTPSDownload(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile, ProgressBarMode progressBarMode = ProgressBarMode::DELAYED, const std::string &name = "");
|
HTTPSDownload(RequestMethod method, const std::string &url, const std::string &postData, const std::string &postMime, const Path &outfile, ProgressBarMode progressBarMode = ProgressBarMode::DELAYED, const std::string &name = "");
|
||||||
~HTTPSDownload();
|
~HTTPSDownload();
|
||||||
|
|
||||||
void SetAccept(const char *mime) override {
|
|
||||||
acceptMime_ = mime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUserAgent(const std::string &userAgent) override {
|
|
||||||
userAgent_ = userAgent;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Start() override;
|
void Start() override;
|
||||||
void Join() override;
|
void Join() override;
|
||||||
|
|
||||||
|
@ -51,11 +43,9 @@ public:
|
||||||
private:
|
private:
|
||||||
RequestMethod method_;
|
RequestMethod method_;
|
||||||
std::string postData_;
|
std::string postData_;
|
||||||
std::string userAgent_;
|
|
||||||
Buffer buffer_;
|
Buffer buffer_;
|
||||||
std::vector<std::string> responseHeaders_;
|
std::vector<std::string> responseHeaders_;
|
||||||
Path outfile_;
|
Path outfile_;
|
||||||
const char *acceptMime_ = "*/*";
|
|
||||||
std::string postMime_;
|
std::string postMime_;
|
||||||
int resultCode_ = 0;
|
int resultCode_ = 0;
|
||||||
bool completed_ = false;
|
bool completed_ = false;
|
||||||
|
|
|
@ -26,8 +26,13 @@ public:
|
||||||
Download(const std::string &url, const std::string &name, bool *cancelled) : url_(url), name_(name), progress_(cancelled) {}
|
Download(const std::string &url, const std::string &name, bool *cancelled) : url_(url), name_(name), progress_(cancelled) {}
|
||||||
virtual ~Download() {}
|
virtual ~Download() {}
|
||||||
|
|
||||||
virtual void SetAccept(const char *mime) = 0;
|
void SetAccept(const char *mime) {
|
||||||
virtual void SetUserAgent(const std::string &userAgent) = 0;
|
acceptMime_ = mime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetUserAgent(const std::string &userAgent) {
|
||||||
|
userAgent_ = userAgent;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Completion callbacks (which these are) are deferred until RunCallback is called. This is so that
|
// NOTE: Completion callbacks (which these are) are deferred until RunCallback is called. This is so that
|
||||||
// the call will end up on the thread that calls g_DownloadManager.Update().
|
// the call will end up on the thread that calls g_DownloadManager.Update().
|
||||||
|
@ -65,6 +70,9 @@ protected:
|
||||||
std::function<void(Download &)> callback_;
|
std::function<void(Download &)> callback_;
|
||||||
std::string url_;
|
std::string url_;
|
||||||
std::string name_;
|
std::string name_;
|
||||||
|
const char *acceptMime_ = "*/*";
|
||||||
|
std::string userAgent_;
|
||||||
|
|
||||||
net::RequestProgress progress_;
|
net::RequestProgress progress_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -349,8 +349,10 @@ void Initialize() {
|
||||||
// Provide a logging function to simplify debugging
|
// Provide a logging function to simplify debugging
|
||||||
rc_client_enable_logging(g_rcClient, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message_callback);
|
rc_client_enable_logging(g_rcClient, RC_CLIENT_LOG_LEVEL_VERBOSE, log_message_callback);
|
||||||
|
|
||||||
// Disable SSL for now.
|
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
|
||||||
|
// Disable SSL if not supported by our platform implementation.
|
||||||
rc_client_set_host(g_rcClient, "http://retroachievements.org");
|
rc_client_set_host(g_rcClient, "http://retroachievements.org");
|
||||||
|
}
|
||||||
|
|
||||||
rc_client_set_event_handler(g_rcClient, event_handler_callback);
|
rc_client_set_event_handler(g_rcClient, event_handler_callback);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue