From 211c4ea9f45db6482f76ccc9945ee19fc78f7e9d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 22 Apr 2011 23:02:28 +0900 Subject: If no data type tag is used in XML-RPC, treat the data as string. --- src/XmlRpcRequestParserStateImpl.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/XmlRpcRequestParserStateImpl.cc') 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(); } -- cgit