summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2019-10-30Fix libxml2 crash on certain invalid inputEdwin Mons
When the libxml2 parser is fed data with an odd combination of invalid input (triggering the parser to assume 2 or 4 byte encodings were in play), I/O errors might occur. In that case, the parser context will not have its internal error set, but the call to xmlParseChunk will return the right error. The parse() method now uses the output of xmlParseChunk directly instead of trying to obtain the error from the parser context afterwards. Encoding errors during parsing were emitted to stderr because the default error handlers were still in place. These have been replaced with custom handlers that suppress the output. Test-Information: Unit tests pass on Debian 9 Change-Id: Ie01db4be467e5197203c9d07d3356f5d44d8b9b4
2019-09-25Remove duplicated argumentsJoanna Hulboj
Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS. Change-Id: Icea837d91f28f47f7b0a90bc620b26c5567c8421
2019-09-24Process attribute and element prefixesJoanna Hulboj
XML (Expat/LibXML) parsing modified to process prefix information. Prefixes for attributes stored within attributes. Prefixes for elements passed in additional callback (only if prefix present). Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS. Change-Id: Ib6b5087feed758c31895f426df6a3c7ea975f248
2019-09-16Close the stream for disallowed XML featuresJoanna Hulboj
According to RFC 6120 if any disallowed XML feature is encountered, we should close the stream with a <restricted-xml/>. The following features of XML are prohibited in XMPP: - processing instructions - internal or external DTD subsets - internal or external entity references - comments Test-information: Unit tests pass on Windows 10 and Ubuntu 18.04.1 LTS Change-Id: I475920c91b7f9da51ab37c106a4783a52f6e3cae
2019-07-22Signal namespace declarations to ParserClientsEdwin Mons
Prior to calling handleStartElement, the ParserClient handleNamespaceDeclaration will fire for each namespace declared on the element. Test-Information: Unit tests pass on Debian 9 for both expat and libxml2 Change-Id: Ic42e83aee83edfbb2aa5c971997808eb6e133223
2019-05-13Add flag to signal final XML dataEdwin Mons
XML parse now takes an optional boolean that will signal that with the data that is fed into the parser, the document should now be complete. This will allow the parser to reject partial documents. Test-Information: Updated unit tests pass. Checked that default behaviour wasn't changed. Tested with various partial and complete documents. Change-Id: Ide7c2e47c49d5667f1febcb23da366e96d0dbc21
2017-03-28Modified XMLBeautifier to handle split payloadsJoanna Hulboj
When receiving network data we were processing it in chunks. Sometimes one XML message got split across multiple chunks. XMLBeautifier was stateless and would create a new parser for every single chunk. This was causing multi-chunk messages to be truncated in the beautified output. The change I made in XMLBeautifier allows it to maintain the state. Test-Information: Tested unger Windows 10 and CentOS. Unit tests pass OK. Change-Id: Idad2a8e0248ed3cbe2b47a12718b909e56ac1279
2016-04-04Modernize code to use C++11 shared_ptr instead of Boost'sTobias Markmann
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
2016-04-01Modernize code to use C++11 nullptr using clang-tidyTobias Markmann
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all source code files on OS X. This does not modernize platform specific code on Linux and Windows Test-Information: Code builds and unit tests pass on OS X 10.11.4. Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
2016-03-31Convert tabs to 4 spaces for all source filesTobias Markmann
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
2016-03-30Apply consistent #include grouping and sorting styleTobias Markmann
Changed "" style includes to <> style. Test-Information: Build with Clang 3.9.0 and ran all tests on OS X 10.11.4. Change-Id: Ic05e53f2e5dba39cc1307b116fc5f17b62ab9eb8
2015-06-29Parse hostname for xep-0233Mili Verma
Test-information: Verified with M-Link. Unit tests pass. Change-Id: Ic675c8d7cd70e01be61c51c0280e1d7208b364ba
2014-12-15Update Copyright in SwiftenKevin Smith
Change-Id: I94ab4bbb68c603fe872abeb8090575de042f5cb4
2014-04-28Create ToplevelElement to replace Element.Richard Maudsley
Change-Id: I3460f6f4a2ffa9b795080664f49d9138440de72d
2013-08-22Added EnumParser.Remko Tronçon
Change-Id: I00b8a052d9d7f761b7bbbaeba7e06990ac5c2087
2012-09-17Support for building swiften as a DLLRemko Tronçon
Added missing SWIFTEN_API declarations. Changed test infrastructure to extend path before running tests.
2012-04-28Make sure our parser doesn't handle entities.Remko Tronçon
2012-04-24Make built-in expat ignore unbound prefix namespaces.Remko Tronçon
This works around a problem with broken servers relaying illegal stanzas from broken clients. Obviously only works when using the bundled Expat. Note that the system OS X libXML also seems to behave this way.
2012-03-20boost::shared_ptr<?>(new ?(...)) -> boost::make_shared<?>(...) ↵Tobias Markmann
transformation where possible. License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
2011-10-07Hoist XML parser factory creation out of Swiften.Remko Tronçon
2011-10-01Added <body/> extractor code.Remko Tronçon
2011-09-23Add support for kicking people from MUCs.Kevin Smith
This also introduces a new DOM-like parser structure, used for the MUC parsers. Partially Resolves: #689
2011-06-01Merge branch 'swift-1.x'Remko Tronçon
* swift-1.x: Added fix for a billion laughs attack on Expat. Conflicts: Swiften/Parser/LibXMLParser.cpp Swiften/Parser/UnitTest/XMLParserTest.cpp
2011-06-01Added fix for a billion laughs attack on Expat.Remko Tronçon
2011-05-02Replace header include guards by pragma once.Remko Tronçon
2011-04-30Replace #icnlude "" by #include <> in Swiften.Remko Tronçon
2011-04-23Finished Stream Management parserialements.Remko Tronçon
2011-04-18Make parser infrastructure parser aware.Remko Tronçon
Resolves: #492
2011-04-18Added XEP-0237 Roster Versioning support.Remko Tronçon
Resolves: #803 Release-Notes: Added support for XEP-0237 Roster Versioning
2011-02-14Removed Swift::String.Remko Tronçon
2011-01-21Code cleanup.Remko Tronçon
2010-12-06Fixed assertion failure on invalid stream start.Remko Tronçon
Resolves: #707
2010-10-15Added Component parser, serializer, element, and connector.Remko Tronçon
2010-08-29Added Stream Management support to Stream Features.Remko Tronçon
2010-08-29Added Stanza Ack Requester & Responder.Remko Tronçon
2010-08-29Added StanzaAckParserTest.Remko Tronçon
2010-08-24Work around LibXML failing on namespace errors/warnings.Remko Tronçon
2010-04-08Added copyrights to Swiften.Kevin Smith
2010-03-28Moving submodule contents back.Remko Tronçon
2010-03-28Removing submodules.Remko Tronçon
2010-03-28Moved Swiften to a separate module.Remko Tronçon
2009-09-14Added bookmark storage payload & parser.Remko Tronçon
2009-08-22Fix expanded tab characters.Remko Tronçon
2009-08-16Remove autoconf/make files.Remko Tronçon
2009-08-16Remove SWIFTEN_CONFIG_H checks.Remko Tronçon
2009-07-31Re-enable accidentally disabled XMLParser tests.Remko Tronçon
2009-07-18Implement incoming linklocal connections.Remko Tronçon
2009-07-13Server stream header support.Remko Tronçon
2009-07-11PayloadParserFactoryCollection additions.Remko Tronçon
Added the ability to set a default PayloadParserFactory. Check factories in reverse order. Add PayloadParserFactoryCollection unit test.
2009-06-01Import.Remko Tronçon