From d77bdcd3e6d604a5f2ae8bc816f43f9e4efdd3d6 Mon Sep 17 00:00:00 2001 From: Eric Frias Date: Tue, 3 Jun 2014 19:12:53 -0700 Subject: [PATCH] Make HTTP headers case insensitive --- src/network/http/http_connection.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/network/http/http_connection.cpp b/src/network/http/http_connection.cpp index 7921bf0..79433c7 100644 --- a/src/network/http/http_connection.cpp +++ b/src/network/http/http_connection.cpp @@ -8,6 +8,7 @@ #include #include #include +#include class fc::http::connection::impl @@ -55,7 +56,7 @@ class fc::http::connection::impl while( *end != '\r' ) ++end; h.val = fc::string(skey,end); rep.headers.push_back(h); - if( h.key == "Content-Length" ) { + if( boost::iequals(h.key, "Content-Length") ) { rep.body.resize( static_cast(to_uint64( fc::string(h.val) ) )); } } @@ -151,12 +152,12 @@ http::request connection::read_request()const { while( *end != '\r' ) ++end; h.val = fc::string(skey,end); req.headers.push_back(h); - if( h.key == "Content-Length" ) { + if( boost::iequals(h.key, "Content-Length")) { auto s = static_cast(to_uint64( fc::string(h.val) ) ); FC_ASSERT( s < 1024*1024 ); req.body.resize( static_cast(to_uint64( fc::string(h.val) ) )); } - if( h.key == "Host" ) { + if( boost::iequals(h.key, "Host") ) { req.domain = h.val; } }