aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-05-09 09:37:31 -0700
committerGavin Andresen <gavinandresen@gmail.com>2011-05-09 09:37:31 -0700
commit752e598a166953fce2f1164047bedc17f850aed0 (patch)
treeaaeced45fe810bbdf00ab8230f3fb46d476deaca
parent2fb1124b0fbbc039307f3697d7d550365c21916c (diff)
parente6ad2c8792c12d9217f8ac7e76dc25e312e76570 (diff)
downloadbitcoin-752e598a166953fce2f1164047bedc17f850aed0.tar.xz
Merge pull request #205 from forrestv/caseinsensitive_rpc_headers
Case-Insensitive JSON-RPC HTTP Headers
-rw-r--r--rpc.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/rpc.cpp b/rpc.cpp
index 90e7f15a91..d91076a0ab 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -1570,10 +1570,11 @@ int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHea
{
string strHeader = str.substr(0, nColon);
boost::trim(strHeader);
+ boost::to_lower(strHeader);
string strValue = str.substr(nColon+1);
boost::trim(strValue);
mapHeadersRet[strHeader] = strValue;
- if (strHeader == "Content-Length")
+ if (strHeader == "content-length")
nLen = atoi(strValue.c_str());
}
}
@@ -1643,7 +1644,7 @@ string DecodeBase64(string s)
bool HTTPAuthorized(map<string, string>& mapHeaders)
{
- string strAuth = mapHeaders["Authorization"];
+ string strAuth = mapHeaders["authorization"];
if (strAuth.substr(0,6) != "Basic ")
return false;
string strUserPass64 = strAuth.substr(6); boost::trim(strUserPass64);
@@ -1872,7 +1873,7 @@ void ThreadRPCServer2(void* parg)
}
// Check authorization
- if (mapHeaders.count("Authorization") == 0)
+ if (mapHeaders.count("authorization") == 0)
{
stream << HTTPReply(401, "") << std::flush;
continue;