From 6185e89e25620525a5c003ffa4117190fdac523f Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 10 Jul 2019 18:02:40 +0200 Subject: [PATCH] Fixes #270 : compilation error when using gcc4.8 --- client_http.hpp | 4 ++-- server_http.hpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/client_http.hpp b/client_http.hpp index f3006d9..282d452 100644 --- a/client_http.hpp +++ b/client_http.hpp @@ -199,7 +199,7 @@ namespace SimpleWeb { /// If reusing the io_service for other tasks, use the asynchronous request functions instead. /// 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. - std::shared_ptr request(const std::string &method, const std::string &path = {"/"}, string_view content = {}, const CaseInsensitiveMultimap &header = {}) { + std::shared_ptr request(const std::string &method, const std::string &path = {"/"}, string_view content = {}, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) { std::shared_ptr response; error_code ec; request(method, path, content, header, [&response, &ec](std::shared_ptr 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. /// 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. - std::shared_ptr request(const std::string &method, const std::string &path, std::istream &content, const CaseInsensitiveMultimap &header = {}) { + std::shared_ptr request(const std::string &method, const std::string &path, std::istream &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) { std::shared_ptr response; error_code ec; request(method, path, content, header, [&response, &ec](std::shared_ptr response_, const error_code &ec_) { diff --git a/server_http.hpp b/server_http.hpp index cece89c..f671b54 100644 --- a/server_http.hpp +++ b/server_http.hpp @@ -144,13 +144,13 @@ namespace SimpleWeb { } /// 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"; write_header(header, 0); } /// 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"; write_header(header, content.size()); if(!content.empty()) @@ -158,7 +158,7 @@ namespace SimpleWeb { } /// 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"; content.seekg(0, std::ios::end); auto size = content.tellg(); @@ -169,12 +169,12 @@ namespace SimpleWeb { } /// 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); } /// 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); }