mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 00:04:49 +02:00
HTTP: Replace ProgressBarMode with a new RequestFlags enum
This commit is contained in:
@@ -299,13 +299,14 @@ int Client::GET(const RequestParams &req, Buffer *output, net::RequestProgress *
|
||||
return code;
|
||||
}
|
||||
|
||||
int Client::POST(const RequestParams &req, const std::string &data, const std::string &mime, Buffer *output, net::RequestProgress *progress) {
|
||||
int Client::POST(const RequestParams &req, std::string_view data, std::string_view mime, Buffer *output, net::RequestProgress *progress) {
|
||||
char otherHeaders[2048];
|
||||
if (mime.empty()) {
|
||||
snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\n", (long long)data.size());
|
||||
} else {
|
||||
snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\nContent-Type: %s\r\n", (long long)data.size(), mime.c_str());
|
||||
snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\nContent-Type: %.*s\r\n", (long long)data.size(), (int)mime.size(), mime.data());
|
||||
}
|
||||
|
||||
int err = SendRequestWithData("POST", req, data, otherHeaders, progress);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
@@ -325,7 +326,7 @@ int Client::POST(const RequestParams &req, const std::string &data, const std::s
|
||||
return code;
|
||||
}
|
||||
|
||||
int Client::POST(const RequestParams &req, const std::string &data, Buffer *output, net::RequestProgress *progress) {
|
||||
int Client::POST(const RequestParams &req, std::string_view data, Buffer *output, net::RequestProgress *progress) {
|
||||
return POST(req, data, "", output, progress);
|
||||
}
|
||||
|
||||
@@ -333,7 +334,7 @@ int Client::SendRequest(const char *method, const RequestParams &req, const char
|
||||
return SendRequestWithData(method, req, "", otherHeaders, progress);
|
||||
}
|
||||
|
||||
int Client::SendRequestWithData(const char *method, const RequestParams &req, const std::string &data, const char *otherHeaders, net::RequestProgress *progress) {
|
||||
int Client::SendRequestWithData(const char *method, const RequestParams &req, std::string_view data, const char *otherHeaders, net::RequestProgress *progress) {
|
||||
progress->Update(0, 0, false);
|
||||
|
||||
net::Buffer buffer;
|
||||
@@ -485,7 +486,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
|
||||
return 0;
|
||||
}
|
||||
|
||||
HTTPRequest::HTTPRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, ProgressBarMode progressBarMode, std::string_view name)
|
||||
HTTPRequest::HTTPRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, RequestFlags progressBarMode, std::string_view name)
|
||||
: Request(method, url, name, &cancelled_, progressBarMode), postData_(postData), postMime_(postMime) {
|
||||
outfile_ = outfile;
|
||||
}
|
||||
@@ -612,4 +613,4 @@ void HTTPRequest::Do() {
|
||||
completed_ = true;
|
||||
}
|
||||
|
||||
} // http
|
||||
} // namespace http
|
||||
|
||||
Reference in New Issue
Block a user