@@ -487,8 +487,7 @@ struct Request {
487487
488488 bool has_header (const std::string &key) const ;
489489 std::string get_header_value (const std::string &key, size_t id = 0 ) const ;
490- template <typename T>
491- T get_header_value (const std::string &key, size_t id = 0 ) const ;
490+ uint64_t get_header_value_u64 (const std::string &key, size_t id = 0 ) const ;
492491 size_t get_header_value_count (const std::string &key) const ;
493492 void set_header (const std::string &key, const std::string &val);
494493
@@ -520,8 +519,7 @@ struct Response {
520519
521520 bool has_header (const std::string &key) const ;
522521 std::string get_header_value (const std::string &key, size_t id = 0 ) const ;
523- template <typename T>
524- T get_header_value (const std::string &key, size_t id = 0 ) const ;
522+ uint64_t get_header_value_u64 (const std::string &key, size_t id = 0 ) const ;
525523 size_t get_header_value_count (const std::string &key) const ;
526524 void set_header (const std::string &key, const std::string &val);
527525
@@ -988,8 +986,8 @@ class Result {
988986 bool has_request_header (const std::string &key) const ;
989987 std::string get_request_header_value (const std::string &key,
990988 size_t id = 0 ) const ;
991- template < typename T>
992- T get_request_header_value ( const std::string &key, size_t id = 0 ) const ;
989+ uint64_t get_request_header_value_u64 ( const std::string &key,
990+ size_t id = 0 ) const ;
993991 size_t get_request_header_value_count (const std::string &key) const ;
994992
995993private:
@@ -1710,15 +1708,9 @@ inline void duration_to_sec_and_usec(const T &duration, U callback) {
17101708 callback (static_cast <time_t >(sec), static_cast <time_t >(usec));
17111709}
17121710
1713- template <typename T>
1714- inline T get_header_value (const Headers & /* headers*/ ,
1715- const std::string & /* key*/ , size_t /* id*/ = 0 ,
1716- uint64_t /* def*/ = 0 ) {}
1717-
1718- template <>
1719- inline uint64_t get_header_value<uint64_t >(const Headers &headers,
1720- const std::string &key, size_t id,
1721- uint64_t def) {
1711+ inline uint64_t get_header_value_u64 (const Headers &headers,
1712+ const std::string &key, size_t id,
1713+ uint64_t def) {
17221714 auto rng = headers.equal_range (key);
17231715 auto it = rng.first ;
17241716 std::advance (it, static_cast <ssize_t >(id));
@@ -1730,14 +1722,14 @@ inline uint64_t get_header_value<uint64_t>(const Headers &headers,
17301722
17311723} // namespace detail
17321724
1733- template < typename T>
1734- inline T Request::get_header_value ( const std::string &key, size_t id) const {
1735- return detail::get_header_value<T> (headers, key, id, 0 );
1725+ inline uint64_t Request::get_header_value_u64 ( const std::string &key,
1726+ size_t id) const {
1727+ return detail::get_header_value_u64 (headers, key, id, 0 );
17361728}
17371729
1738- template < typename T>
1739- inline T Response::get_header_value ( const std::string &key, size_t id) const {
1740- return detail::get_header_value<T> (headers, key, id, 0 );
1730+ inline uint64_t Response::get_header_value_u64 ( const std::string &key,
1731+ size_t id) const {
1732+ return detail::get_header_value_u64 (headers, key, id, 0 );
17411733}
17421734
17431735template <typename ... Args>
@@ -1906,10 +1898,9 @@ inline std::ostream &operator<<(std::ostream &os, const Error &obj) {
19061898 return os;
19071899}
19081900
1909- template <typename T>
1910- inline T Result::get_request_header_value (const std::string &key,
1911- size_t id) const {
1912- return detail::get_header_value<T>(request_headers_, key, id, 0 );
1901+ inline uint64_t Result::get_request_header_value_u64 (const std::string &key,
1902+ size_t id) const {
1903+ return detail::get_header_value_u64 (request_headers_, key, id, 0 );
19131904}
19141905
19151906template <class Rep , class Period >
@@ -3894,7 +3885,7 @@ bool read_content(Stream &strm, T &x, size_t payload_max_length, int &status,
38943885 } else if (!has_header (x.headers , " Content-Length" )) {
38953886 ret = read_content_without_length (strm, out);
38963887 } else {
3897- auto len = get_header_value< uint64_t > (x.headers , " Content-Length" );
3888+ auto len = get_header_value_u64 (x.headers , " Content-Length" , 0 , 0 );
38983889 if (len > payload_max_length) {
38993890 exceed_payload_max_length = true ;
39003891 skip_content_with_length (strm, len);
0 commit comments