summaryrefslogtreecommitdiff
path: root/src/XmlRpcRequestParserStateImpl.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-04-22 23:02:28 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-04-22 23:02:28 +0900
commit211c4ea9f45db6482f76ccc9945ee19fc78f7e9d (patch)
treef3e637f9f0af186e8114b95258d9e37d7c766b51 /src/XmlRpcRequestParserStateImpl.cc
parent6ee58e28729f7332c353ea89271eb1e75e5bf0a4 (diff)
If no data type tag is used in XML-RPC, treat the data as string.
Diffstat (limited to 'src/XmlRpcRequestParserStateImpl.cc')
-rw-r--r--src/XmlRpcRequestParserStateImpl.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/XmlRpcRequestParserStateImpl.cc b/src/XmlRpcRequestParserStateImpl.cc
index 7cf1c5ac..2d406e8e 100644
--- a/src/XmlRpcRequestParserStateImpl.cc
+++ b/src/XmlRpcRequestParserStateImpl.cc
@@ -168,7 +168,20 @@ void ValueXmlRpcRequestParserState::beginElement
stm->pushUnknownElementState();
}
}
-
+
+void ValueXmlRpcRequestParserState::endElement
+(XmlRpcRequestParserStateMachine* stm,
+ const std::string& name,
+ const std::string& characters)
+{
+ // XML-RPC specification says that if no data type tag is used, the
+ // data must be treated as string. To prevent from overwriting
+ // current frame value, we first check it is still null.
+ if(!stm->getCurrentFrameValue() && !characters.empty()) {
+ stm->setCurrentFrameValue(String::g(characters));
+ }
+}
+
// IntXmlRpcRequestParserState
void IntXmlRpcRequestParserState::beginElement
@@ -321,6 +334,7 @@ void ArrayValueXmlRpcRequestParserState::endElement
const std::string& name,
const std::string& characters)
{
+ ValueXmlRpcRequestParserState::endElement(stm, name, characters);
stm->popArrayFrame();
}