Enable C++11 on GCC; Link boost libs and pthread on GCC.

This commit is contained in:
Chunting Gu
2018-04-07 11:05:14 +08:00
parent c557430b8e
commit 23090ee369
12 changed files with 210 additions and 12 deletions
+4
View File
@@ -1,3 +1,7 @@
if(UNIX)
add_definitions(-std=c++11)
endif()
option(WEBCC_DEBUG_OUTPUT "Enable debug output?" OFF)
if(WEBCC_DEBUG_OUTPUT)
+4 -3
View File
@@ -37,7 +37,7 @@ static void SetTimeout(boost::asio::ip::tcp::socket& socket,
#else // POSIX
struct timeval tv;
tv.tv_sec = timeout_seconds_;
tv.tv_sec = timeout_seconds;
tv.tv_usec = 0;
setsockopt(socket.native_handle(), SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(socket.native_handle(), SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
@@ -107,11 +107,12 @@ Error HttpClient::SendRequest(const HttpRequest& request,
size_t length = socket.read_some(boost::asio::buffer(buffer_), ec);
if (length == 0 || ec) {
#if defined _WINDOWS
if (ec.value() == WSAETIMEDOUT) {
return kSocketTimeoutError;
} else {
return kSocketReadError;
}
#endif
return kSocketReadError;
}
#if WEBCC_DEBUG_OUTPUT
+2 -1
View File
@@ -1,4 +1,5 @@
#include "webcc/http_response.h"
#include <iostream>
namespace webcc {
@@ -98,7 +99,7 @@ std::vector<boost::asio::const_buffer> HttpResponse::ToBuffers() const {
if (IsContentLengthValid()) {
buffers.push_back(boost::asio::buffer(content_));
}
return buffers;
}
+1 -1
View File
@@ -45,7 +45,7 @@ Error SoapClient::Call(const std::string& operation,
http_request.SetHeader(kSoapAction, operation);
http_request.set_content(std::move(http_content));
http_request.MakeStartLine();
http_request.Build();
HttpResponse http_response;