mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Fix some comments, remove redundant fields etc
This commit is contained in:
@@ -229,8 +229,6 @@ Client::~Client() {
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
// Ignores line folding (deprecated), but respects field combining.
|
||||
// Don't use for Set-Cookie, which is a special header per RFC 7230.
|
||||
bool GetHeaderValue(const std::vector<std::string> &responseHeaders, std::string_view header, std::string *value) {
|
||||
std::string search(header);
|
||||
search.push_back(':');
|
||||
@@ -317,7 +315,7 @@ int Client::POST(const RequestParams &req, std::string_view data, std::string_vi
|
||||
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(), (int)mime.size(), mime.data());
|
||||
snprintf(otherHeaders, sizeof(otherHeaders), "Content-Length: %lld\r\nContent-Type: %.*s\r\n", (long long)data.size(), STR_VIEW(mime));
|
||||
}
|
||||
|
||||
int err = SendRequestWithData("POST", req, data, otherHeaders, progress);
|
||||
@@ -514,8 +512,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
|
||||
}
|
||||
|
||||
HTTPRequest::HTTPRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, RequestFlags flags, net::ResolveFunc customResolve, std::string_view name)
|
||||
: Request(method, url, name, &cancelled_, flags), postData_(postData), postMime_(postMime), customResolve_(customResolve) {
|
||||
outfile_ = outfile;
|
||||
: Request(method, url, name, outfile, &cancelled_, flags), postData_(postData), postMime_(postMime), customResolve_(customResolve) {
|
||||
}
|
||||
|
||||
HTTPRequest::~HTTPRequest() {
|
||||
@@ -539,6 +536,8 @@ void HTTPRequest::Join() {
|
||||
}
|
||||
|
||||
void HTTPRequest::SetFailed(int code) {
|
||||
// TODO: Why are we not using code here?
|
||||
|
||||
failed_ = true;
|
||||
progress_.Update(0, 0, true);
|
||||
completed_ = true;
|
||||
|
||||
@@ -49,6 +49,8 @@ private:
|
||||
|
||||
namespace http {
|
||||
|
||||
// Ignores line folding (deprecated), but respects field combining.
|
||||
// Don't use for Set-Cookie, which is a special header per RFC 7230.
|
||||
bool GetHeaderValue(const std::vector<std::string> &responseHeaders, std::string_view header, std::string *value);
|
||||
|
||||
class RequestParams {
|
||||
@@ -132,7 +134,7 @@ private:
|
||||
class CachedRequest : public Request {
|
||||
public:
|
||||
CachedRequest(RequestMethod method, std::string_view url, std::string_view name, bool *cancelled, RequestFlags flags, std::string_view responseData)
|
||||
: Request(method, url, name, cancelled, flags)
|
||||
: Request(method, url, name, Path(), cancelled, flags)
|
||||
{
|
||||
buffer_.Append(responseData);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
namespace http {
|
||||
|
||||
HTTPSRequest::HTTPSRequest(RequestMethod method, std::string_view url, std::string_view postData, std::string_view postMime, const Path &outfile, RequestFlags flags, std::string_view name)
|
||||
: Request(method, url, name, &cancelled_, flags), method_(method), postData_(postData), postMime_(postMime) {
|
||||
outfile_ = outfile;
|
||||
: Request(method, url, name, outfile, &cancelled_, flags), postData_(postData), postMime_(postMime) {
|
||||
}
|
||||
|
||||
HTTPSRequest::~HTTPSRequest() {
|
||||
@@ -61,7 +60,7 @@ void HTTPSRequest::Join() {
|
||||
res_ = nullptr;
|
||||
req_ = nullptr;
|
||||
} else {
|
||||
ERROR_LOG(Log::HTTP, "HTTPSDownload::Join not implemented");
|
||||
ERROR_LOG(Log::HTTP, "HTTPSRequest::Join called before completion");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ public:
|
||||
bool Failed() const override { return failed_; }
|
||||
|
||||
private:
|
||||
RequestMethod method_;
|
||||
std::string postData_;
|
||||
std::string postMime_;
|
||||
bool completed_ = false;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
Request::Request(RequestMethod method, std::string_view url, std::string_view name, bool *cancelled, RequestFlags flags)
|
||||
: method_(method), url_(url), name_(name), progress_(cancelled), flags_(flags) {
|
||||
Request::Request(RequestMethod method, std::string_view url, std::string_view name, const Path &outFile, bool *cancelled, RequestFlags flags)
|
||||
: method_(method), url_(url), name_(name), outfile_(outFile), progress_(cancelled), flags_(flags) {
|
||||
INFO_LOG(Log::HTTP, "HTTP %s request: %.*s (%.*s)", RequestMethodToString(method), (int)url.size(), url.data(), (int)name.size(), name.data());
|
||||
|
||||
progress_.callback = [this](int64_t bytes, int64_t contentLength, bool done) {
|
||||
|
||||
@@ -31,7 +31,7 @@ using RequestCompletionCallback = std::function<void(Request &)>;
|
||||
// Abstract request.
|
||||
class Request {
|
||||
public:
|
||||
Request(RequestMethod method, std::string_view url, std::string_view name, bool *cancelled, RequestFlags mode);
|
||||
Request(RequestMethod method, std::string_view url, std::string_view name, const Path &outFile, bool *cancelled, RequestFlags mode);
|
||||
virtual ~Request() {}
|
||||
|
||||
void SetAccept(const char *mime) {
|
||||
|
||||
Reference in New Issue
Block a user