clang format, based on cpprest
This commit is contained in:
@ -6,39 +6,38 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#include <tuple>
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
#include "IXSocket.h"
|
||||
#include "IXWebSocketHttpHeaders.h"
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <tuple>
|
||||
|
||||
namespace ix
|
||||
{
|
||||
enum class HttpErrorCode : int
|
||||
{
|
||||
Ok = 0,
|
||||
CannotConnect = 1,
|
||||
Timeout = 2,
|
||||
Gzip = 3,
|
||||
UrlMalformed = 4,
|
||||
CannotCreateSocket = 5,
|
||||
SendError = 6,
|
||||
ReadError = 7,
|
||||
CannotReadStatusLine = 8,
|
||||
MissingStatus = 9,
|
||||
HeaderParsingError = 10,
|
||||
MissingLocation = 11,
|
||||
TooManyRedirects = 12,
|
||||
ChunkReadError = 13,
|
||||
CannotReadBody = 14
|
||||
Ok = 0,
|
||||
CannotConnect = 1,
|
||||
Timeout = 2,
|
||||
Gzip = 3,
|
||||
UrlMalformed = 4,
|
||||
CannotCreateSocket = 5,
|
||||
SendError = 6,
|
||||
ReadError = 7,
|
||||
CannotReadStatusLine = 8,
|
||||
MissingStatus = 9,
|
||||
HeaderParsingError = 10,
|
||||
MissingLocation = 11,
|
||||
TooManyRedirects = 12,
|
||||
ChunkReadError = 13,
|
||||
CannotReadBody = 14
|
||||
};
|
||||
|
||||
using HttpResponse = std::tuple<int, // status
|
||||
using HttpResponse = std::tuple<int, // status
|
||||
HttpErrorCode, // error code
|
||||
WebSocketHttpHeaders,
|
||||
std::string, // payload
|
||||
@ -64,15 +63,14 @@ namespace ix
|
||||
OnProgressCallback onProgressCallback;
|
||||
};
|
||||
|
||||
class HttpClient {
|
||||
class HttpClient
|
||||
{
|
||||
public:
|
||||
HttpClient();
|
||||
~HttpClient();
|
||||
|
||||
HttpResponse get(const std::string& url,
|
||||
const HttpRequestArgs& args);
|
||||
HttpResponse head(const std::string& url,
|
||||
const HttpRequestArgs& args);
|
||||
HttpResponse get(const std::string& url, const HttpRequestArgs& args);
|
||||
HttpResponse head(const std::string& url, const HttpRequestArgs& args);
|
||||
|
||||
HttpResponse post(const std::string& url,
|
||||
const HttpParameters& httpParameters,
|
||||
@ -94,9 +92,7 @@ namespace ix
|
||||
|
||||
void log(const std::string& msg, const HttpRequestArgs& args);
|
||||
|
||||
bool gzipInflate(
|
||||
const std::string& in,
|
||||
std::string& out);
|
||||
bool gzipInflate(const std::string& in, std::string& out);
|
||||
|
||||
std::shared_ptr<Socket> _socket;
|
||||
|
||||
@ -104,4 +100,4 @@ namespace ix
|
||||
const static std::string kGet;
|
||||
const static std::string kHead;
|
||||
};
|
||||
}
|
||||
} // namespace ix
|
||||
|
Reference in New Issue
Block a user