[mapguide-commits] r9570 - in sandbox/jng/wfs_hits/Web/src: ApacheAgent CgiAgent IsapiAgent MapAgentCommon
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jul 12 05:42:38 PDT 2019
Author: jng
Date: 2019-07-12 05:42:38 -0700 (Fri, 12 Jul 2019)
New Revision: 9570
Modified:
sandbox/jng/wfs_hits/Web/src/ApacheAgent/ApachePostParser.cpp
sandbox/jng/wfs_hits/Web/src/CgiAgent/CgiPostParser.cpp
sandbox/jng/wfs_hits/Web/src/IsapiAgent/IsapiPostParser.cpp
sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.cpp
sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.h
Log:
#2799: Allow for "application/xml" as an alternative XML mime type
Modified: sandbox/jng/wfs_hits/Web/src/ApacheAgent/ApachePostParser.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/ApacheAgent/ApachePostParser.cpp 2019-07-11 10:02:35 UTC (rev 9569)
+++ sandbox/jng/wfs_hits/Web/src/ApacheAgent/ApachePostParser.cpp 2019-07-12 12:42:38 UTC (rev 9570)
@@ -158,7 +158,7 @@
// The check for text/xml is not always sufficient. CarbonTools, for example,
// fails to set Content-Type: text/xml and just sends Content-Type: utf-8.
// A better check might be looking into the buffer to find "<?xml" at the beginning.
- else if (content.find(MapAgentStrings::TextXml) != content.npos || MapAgentCommon::IsXmlPi((char *)m_pBuffer))
+ else if (MapAgentStrings::IsXmlMimeType(content) || MapAgentCommon::IsXmlPi((char *)m_pBuffer))
{
m_pBuffer[totalBytes] = '\0';
params->SetXmlPostData((char *)m_pBuffer);
Modified: sandbox/jng/wfs_hits/Web/src/CgiAgent/CgiPostParser.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/CgiAgent/CgiPostParser.cpp 2019-07-11 10:02:35 UTC (rev 9569)
+++ sandbox/jng/wfs_hits/Web/src/CgiAgent/CgiPostParser.cpp 2019-07-12 12:42:38 UTC (rev 9570)
@@ -145,9 +145,9 @@
// url-encoded, since the question mark in <?xml...?>
// should itself be url-encoded: <%3Fxml... )
if(IsXmlPi(m_buf))
- params->SetXmlPostData(m_buf);
+ params->SetXmlPostData(m_buf);
else
- MapAgentGetParser::Parse(m_buf, params);
+ MapAgentGetParser::Parse(m_buf, params);
}
}
else if (content.find(MapAgentStrings::MultiPartForm) != content.npos)
@@ -281,7 +281,7 @@
// The check for text/xml is not always sufficient. CarbonTools, for example,
// fails to set Content-Type: text/xml and just sends Content-Type: utf-8.
// A better check might be looking into the buffer to find "<?xml" at the beginning.
- else if (content.find(MapAgentStrings::TextXml) != content.npos || IsXmlPi(m_buf))
+ else if (MapAgentStrings::IsXmlMimeType(content) || IsXmlPi(m_buf))
{
m_buf[nBytes] = '\0';
params->SetXmlPostData(m_buf);
Modified: sandbox/jng/wfs_hits/Web/src/IsapiAgent/IsapiPostParser.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/IsapiAgent/IsapiPostParser.cpp 2019-07-11 10:02:35 UTC (rev 9569)
+++ sandbox/jng/wfs_hits/Web/src/IsapiAgent/IsapiPostParser.cpp 2019-07-12 12:42:38 UTC (rev 9570)
@@ -140,9 +140,9 @@
// 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);
+ params->SetXmlPostData((char *)m_pBuffer);
else
- MapAgentGetParser::Parse((char *)m_pBuffer, params);
+ MapAgentGetParser::Parse((char *)m_pBuffer, params);
}
}
else if (content.find(MapAgentStrings::MultiPartForm) != content.npos)
@@ -185,7 +185,7 @@
// The check for text/xml is not always sufficient. CarbonTools, for example,
// fails to set Content-Type: text/xml and just sends Content-Type: utf-8.
// A better check might be looking into the buffer to find "<?xml" at the beginning.
- else if (content.find(MapAgentStrings::TextXml) != content.npos || MapAgentCommon::IsXmlPi((char *)m_pBuffer))
+ else if (MapAgentStrings::IsXmlMimeType(content) || MapAgentCommon::IsXmlPi((char *)m_pBuffer))
{
m_pBuffer[dwTotalBytes] = '\0';
params->SetXmlPostData((char *)m_pBuffer);
Modified: sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.cpp
===================================================================
--- sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.cpp 2019-07-11 10:02:35 UTC (rev 9569)
+++ sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.cpp 2019-07-12 12:42:38 UTC (rev 9570)
@@ -51,6 +51,7 @@
const char* MapAgentStrings::TextPlain = "text/plain";
const char* MapAgentStrings::TextHtml = "text/html";
const char* MapAgentStrings::TextXml = "text/xml";
+const char* MapAgentStrings::ApplicationXml = "application/xml";
const char* MapAgentStrings::PostBoundary = "boundary=";
const char* MapAgentStrings::PostName = "name=\"";
const char* MapAgentStrings::PostContent = "Content-Type: ";
@@ -71,3 +72,9 @@
// used to indicate the creation of temporary files as part of a request
const wchar_t* MapAgentStrings::TempfileKey = L"tempfile";
+
+bool MapAgentStrings::IsXmlMimeType(const std::string& content)
+{
+ return content.find(MapAgentStrings::TextXml) != content.npos
+ || content.find(MapAgentStrings::ApplicationXml) != content.npos;
+}
\ No newline at end of file
Modified: sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.h
===================================================================
--- sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.h 2019-07-11 10:02:35 UTC (rev 9569)
+++ sandbox/jng/wfs_hits/Web/src/MapAgentCommon/MapAgentStrings.h 2019-07-12 12:42:38 UTC (rev 9570)
@@ -18,6 +18,8 @@
#ifndef MAPAGENT_STRINGS_H
#define MAPAGENT_STRINGS_H
+#include <string>
+
class MapAgentStrings
{
public:
@@ -54,6 +56,7 @@
const static char* TextPlain;
const static char* TextHtml;
const static char* TextXml;
+ const static char* ApplicationXml;
const static char* PostBoundary;
const static char* PostName;
const static char* PostContent;
@@ -71,5 +74,7 @@
const static wchar_t* FailedAuth2;
const static wchar_t* ProductName;
const static wchar_t* TempfileKey;
+
+ static bool IsXmlMimeType(const std::string& mimeType);
};
#endif
More information about the mapguide-commits
mailing list