[mapguide-commits] r8435 - in sandbox/adsk/2.5k/Web/src: CgiAgent IsapiAgent

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Oct 29 17:19:01 PDT 2014


Author: hubu
Date: 2014-10-29 17:19:00 -0700 (Wed, 29 Oct 2014)
New Revision: 8435

Modified:
   sandbox/adsk/2.5k/Web/src/CgiAgent/CgiPostParser.cpp
   sandbox/adsk/2.5k/Web/src/IsapiAgent/IsapiPostParser.cpp
Log:
#2199, merge r7257 to adsk/2.5k branch.

Modified: sandbox/adsk/2.5k/Web/src/CgiAgent/CgiPostParser.cpp
===================================================================
--- sandbox/adsk/2.5k/Web/src/CgiAgent/CgiPostParser.cpp	2014-10-24 17:22:48 UTC (rev 8434)
+++ sandbox/adsk/2.5k/Web/src/CgiAgent/CgiPostParser.cpp	2014-10-30 00:19:00 UTC (rev 8435)
@@ -122,26 +122,33 @@
         string content = contentType;
         DumpMessage("Content type: %s", content.c_str());
 
+        if (content.empty())
+        {
+            params->SetXmlPostData("");
+        }
         if (content.find(MapAgentStrings::UrlEncoded) == 0)
         {
-            m_buf[nBytes] = '\0';
+            if (nBytes > 0)
+            {
+                m_buf[nBytes] = '\0';
 
-            // Here's another case of interoperability "Forgiveness
-            // and Tolerance": degree, among other clients, sends along
-            // a POST with xml contents, but fails to correctly set the
-            // mime type.  You guessed it: it says it's url-encoded.
-            // ----------------
-            // If we got here, but determine that the contents look
-            // and feel like XML, it's a safe bet that it should
-            // be treated like XML.  Otherwise, we assume the
-            // content-type is probably correct.  (Note that
-            // the IsXmlPi should conveniently fail if it really IS
-            // url-encoded, since the question mark in <?xml...?>
-            // should itself be url-encoded: <%3Fxml... )
-            if(IsXmlPi(m_buf))
-                params->SetXmlPostData(m_buf);
-            else
-                MapAgentGetParser::Parse(m_buf, params);
+                // Here's another case of interoperability "Forgiveness
+                // and Tolerance": degree, among other clients, sends along
+                // a POST with xml contents, but fails to correctly set the
+                // mime type.  You guessed it: it says it's url-encoded.
+                // ----------------
+                // If we got here, but determine that the contents look
+                // and feel like XML, it's a safe bet that it should
+                // be treated like XML.  Otherwise, we assume the
+                // content-type is probably correct.  (Note that
+                // the IsXmlPi should conveniently fail if it really IS
+                // url-encoded, since the question mark in <?xml...?>
+                // should itself be url-encoded: <%3Fxml... )
+                if(IsXmlPi(m_buf))
+	                params->SetXmlPostData(m_buf);
+                else
+	                MapAgentGetParser::Parse(m_buf, params);
+            }
         }
         else if (content.find(MapAgentStrings::MultiPartForm) != content.npos)
         {

Modified: sandbox/adsk/2.5k/Web/src/IsapiAgent/IsapiPostParser.cpp
===================================================================
--- sandbox/adsk/2.5k/Web/src/IsapiAgent/IsapiPostParser.cpp	2014-10-24 17:22:48 UTC (rev 8434)
+++ sandbox/adsk/2.5k/Web/src/IsapiAgent/IsapiPostParser.cpp	2014-10-30 00:19:00 UTC (rev 8435)
@@ -117,26 +117,33 @@
 
     string content = m_pECB->lpszContentType;
 
+    if (content.empty())
+    {
+        params->SetXmlPostData("");
+    }
     if (content.find(MapAgentStrings::UrlEncoded) == 0)
     {
-        m_pBuffer[dwTotalBytes] = '\0';  // null terminate
+        if (dwTotalBytes > 0)
+        {
+            m_pBuffer[dwTotalBytes] = '\0';  // null terminate
 
-        // Here's another case of interoperability "Forgiveness
-        // and Tolerance": degree, among other clients, sends along
-        // a POST with xml contents, but fails to correctly set the
-        // mime type.  You guessed it: it says it's url-encoded.
-        // ----------------
-        // If we got here, but determine that the contents look
-        // and feel like XML, it's a safe bet that it should
-        // be treated like XML.  Otherwise, we assume the
-        // content-type is probably correct.  (Note that
-        // the IsXmlPi should conveniently fail if it really IS
-        // url-encoded, since the question mark in <?xml...?>
-        // should itself be url-encoded: <%3Fxml... )
-        if (MapAgentCommon::IsXmlPi((char *)m_pBuffer))
-            params->SetXmlPostData((char *)m_pBuffer);
-        else
-            MapAgentGetParser::Parse((char *)m_pBuffer, params);
+            // Here's another case of interoperability "Forgiveness
+            // and Tolerance": degree, among other clients, sends along
+            // a POST with xml contents, but fails to correctly set the
+            // mime type.  You guessed it: it says it's url-encoded.
+            // ----------------
+            // If we got here, but determine that the contents look
+            // and feel like XML, it's a safe bet that it should
+            // be treated like XML.  Otherwise, we assume the
+            // content-type is probably correct.  (Note that
+            // the IsXmlPi should conveniently fail if it really IS
+            // url-encoded, since the question mark in <?xml...?>
+            // should itself be url-encoded: <%3Fxml... )
+            if (MapAgentCommon::IsXmlPi((char *)m_pBuffer))
+	            params->SetXmlPostData((char *)m_pBuffer);
+            else
+	            MapAgentGetParser::Parse((char *)m_pBuffer, params);
+        }
     }
     else if (content.find(MapAgentStrings::MultiPartForm) != content.npos)
     {



More information about the mapguide-commits mailing list