]> Git Repo - VerusCoin.git/commitdiff
Initial commit of changes to make JSON-RPC HTTP headers case-insensitive, as per...
authorForrest Voight <forrest@forrest-laptop.(none)>
Sun, 8 May 2011 21:10:33 +0000 (17:10 -0400)
committerForrest Voight <forrest@forrest-laptop.(none)>
Mon, 9 May 2011 00:33:46 +0000 (20:33 -0400)
rpc.cpp

diff --git a/rpc.cpp b/rpc.cpp
index 90e7f15a9164c945d619f5286636c40c56ea0ca6..d91076a0abb799350442c91a4d0aadc9df4c8a87 100644 (file)
--- 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;
This page took 0.048204 seconds and 4 git commands to generate.