Mercurial > hg > bitcoin
changeset 571:f8ef98a118bd draft
Merge pull request #205 from forrestv/caseinsensitive_rpc_headers
Case-Insensitive JSON-RPC HTTP Headers
author | Gavin Andresen <gavinandresen@gmail.com> |
---|---|
date | Mon, 09 May 2011 09:37:31 -0700 (2011-05-09) |
parents | aa1f5ffbf05b (current diff) 9daa680d2ded (diff) |
children | 80893cf88c72 |
files | |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/rpc.cpp +++ b/rpc.cpp @@ -1570,10 +1570,11 @@ { 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 @@ 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 @@ } // Check authorization - if (mapHeaders.count("Authorization") == 0) + if (mapHeaders.count("authorization") == 0) { stream << HTTPReply(401, "") << std::flush; continue;