summaryrefslogtreecommitdiff
path: root/src/net/HttpClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/HttpClient.cpp')
-rw-r--r--src/net/HttpClient.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/net/HttpClient.cpp b/src/net/HttpClient.cpp
index 5027b09..b9813ad 100644
--- a/src/net/HttpClient.cpp
+++ b/src/net/HttpClient.cpp
@@ -32,36 +32,36 @@ using namespace boost::asio::local;
namespace TgBot {
HttpClient& HttpClient::getInstance() {
- static HttpClient result;
- return result;
+ static HttpClient result;
+ return result;
}
string HttpClient::makeRequest(const Url& url, const vector<HttpReqArg>& args) {
- ssl::context context(ssl::context::sslv23);
- context.set_default_verify_paths();
+ ssl::context context(ssl::context::sslv23);
+ context.set_default_verify_paths();
- ssl::stream<tcp::socket> socket(_ioService, context);
- tcp::resolver resolver(_ioService);
- tcp::resolver::query query(url.host, url.protocol);
+ ssl::stream<tcp::socket> socket(_ioService, context);
+ tcp::resolver resolver(_ioService);
+ tcp::resolver::query query(url.host, url.protocol);
- connect(socket.lowest_layer(), resolver.resolve(query));
+ connect(socket.lowest_layer(), resolver.resolve(query));
- socket.set_verify_mode(ssl::verify_none);
- socket.set_verify_callback(ssl::rfc2818_verification(url.host));
- socket.handshake(ssl::stream<tcp::socket>::client);
+ socket.set_verify_mode(ssl::verify_none);
+ socket.set_verify_callback(ssl::rfc2818_verification(url.host));
+ socket.handshake(ssl::stream<tcp::socket>::client);
- string requestText = HttpParser::getInstance().generateRequest(url, args, false);
- write(socket, buffer(requestText.c_str(), requestText.length()));
+ string requestText = HttpParser::getInstance().generateRequest(url, args, false);
+ write(socket, buffer(requestText.c_str(), requestText.length()));
- string response;
- char buff[1024];
- boost::system::error_code error;
- while (!error) {
- size_t bytes = read(socket, buffer(buff), error);
- response += string(buff, bytes);
- }
+ string response;
+ char buff[1024];
+ boost::system::error_code error;
+ while (!error) {
+ size_t bytes = read(socket, buffer(buff), error);
+ response += string(buff, bytes);
+ }
- return HttpParser::getInstance().parseResponse(response);
+ return HttpParser::getInstance().parseResponse(response);
}
}