Fixes #270 : compilation error when using gcc4.8

This commit is contained in:
eidheim 2019-07-10 18:02:40 +02:00
commit 6185e89e25
2 changed files with 7 additions and 7 deletions

View file

@ -199,7 +199,7 @@ namespace SimpleWeb {
/// If reusing the io_service for other tasks, use the asynchronous request functions instead. /// If reusing the io_service for other tasks, use the asynchronous request functions instead.
/// Do not use concurrently with the asynchronous request functions. /// Do not use concurrently with the asynchronous request functions.
/// When requesting Server-Sent Events: will throw on error::eof, please use asynchronous request functions instead. /// When requesting Server-Sent Events: will throw on error::eof, please use asynchronous request functions instead.
std::shared_ptr<Response> request(const std::string &method, const std::string &path = {"/"}, string_view content = {}, const CaseInsensitiveMultimap &header = {}) { std::shared_ptr<Response> request(const std::string &method, const std::string &path = {"/"}, string_view content = {}, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
std::shared_ptr<Response> response; std::shared_ptr<Response> response;
error_code ec; error_code ec;
request(method, path, content, header, [&response, &ec](std::shared_ptr<Response> response_, const error_code &ec_) { request(method, path, content, header, [&response, &ec](std::shared_ptr<Response> response_, const error_code &ec_) {
@ -229,7 +229,7 @@ namespace SimpleWeb {
/// If reusing the io_service for other tasks, use the asynchronous request functions instead. /// If reusing the io_service for other tasks, use the asynchronous request functions instead.
/// Do not use concurrently with the asynchronous request functions. /// Do not use concurrently with the asynchronous request functions.
/// When requesting Server-Sent Events: will throw on error::eof, please use asynchronous request functions instead. /// When requesting Server-Sent Events: will throw on error::eof, please use asynchronous request functions instead.
std::shared_ptr<Response> request(const std::string &method, const std::string &path, std::istream &content, const CaseInsensitiveMultimap &header = {}) { std::shared_ptr<Response> request(const std::string &method, const std::string &path, std::istream &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
std::shared_ptr<Response> response; std::shared_ptr<Response> response;
error_code ec; error_code ec;
request(method, path, content, header, [&response, &ec](std::shared_ptr<Response> response_, const error_code &ec_) { request(method, path, content, header, [&response, &ec](std::shared_ptr<Response> response_, const error_code &ec_) {

View file

@ -144,13 +144,13 @@ namespace SimpleWeb {
} }
/// Convenience function for writing status line, potential header fields, and empty content /// Convenience function for writing status line, potential header fields, and empty content
void write(StatusCode status_code = StatusCode::success_ok, const CaseInsensitiveMultimap &header = {}) { void write(StatusCode status_code = StatusCode::success_ok, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n"; *this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
write_header(header, 0); write_header(header, 0);
} }
/// Convenience function for writing status line, header fields, and content /// Convenience function for writing status line, header fields, and content
void write(StatusCode status_code, string_view content, const CaseInsensitiveMultimap &header = {}) { void write(StatusCode status_code, string_view content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n"; *this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
write_header(header, content.size()); write_header(header, content.size());
if(!content.empty()) if(!content.empty())
@ -158,7 +158,7 @@ namespace SimpleWeb {
} }
/// Convenience function for writing status line, header fields, and content /// Convenience function for writing status line, header fields, and content
void write(StatusCode status_code, std::istream &content, const CaseInsensitiveMultimap &header = {}) { void write(StatusCode status_code, std::istream &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n"; *this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
content.seekg(0, std::ios::end); content.seekg(0, std::ios::end);
auto size = content.tellg(); auto size = content.tellg();
@ -169,12 +169,12 @@ namespace SimpleWeb {
} }
/// Convenience function for writing success status line, header fields, and content /// Convenience function for writing success status line, header fields, and content
void write(string_view content, const CaseInsensitiveMultimap &header = {}) { void write(string_view content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
write(StatusCode::success_ok, content, header); write(StatusCode::success_ok, content, header);
} }
/// Convenience function for writing success status line, header fields, and content /// Convenience function for writing success status line, header fields, and content
void write(std::istream &content, const CaseInsensitiveMultimap &header = {}) { void write(std::istream &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
write(StatusCode::success_ok, content, header); write(StatusCode::success_ok, content, header);
} }