summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-01-09 16:39:11 (GMT)
committerSwift Review <review@swift.im>2015-02-11 09:35:21 (GMT)
commit779f0d57bc9d90300aad0b1386dc937612ac35f4 (patch)
tree2b7beb4db6af92eef45a6adaf0118d3ba149056b /Swiften/Parser
parent66567c962202920b0d6bc06029ed37565cd4a81c (diff)
downloadswift-779f0d57bc9d90300aad0b1386dc937612ac35f4.zip
swift-779f0d57bc9d90300aad0b1386dc937612ac35f4.tar.bz2
Support domain names in S5B proxy <streamhost> tags.
S5BProxyManager now resolves DNS names of proxy entries discovered via service discovery. Test-Information: Tested against a XMPP installation that uses domain names in proxy entires. Change-Id: I728243333ec6e62e86f088f2a7b6e222c629757b
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp b/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp
index 6e33f16..5cfd28d 100644
--- a/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp
+++ b/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp
@@ -4,6 +4,12 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#include "S5BProxyRequestParser.h"
#include <boost/lexical_cast.hpp>
@@ -20,7 +26,7 @@ S5BProxyRequestParser::~S5BProxyRequestParser() {
void S5BProxyRequestParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
if (element == "streamhost") {
if (attributes.getAttributeValue("host") && attributes.getAttributeValue("jid") && attributes.getAttributeValue("port")) {
- HostAddress address = attributes.getAttributeValue("host").get_value_or("");
+ std::string host = attributes.getAttributeValue("host").get_value_or("");
int port = -1;
JID jid = attributes.getAttributeValue("jid").get_value_or("");
@@ -29,9 +35,10 @@ void S5BProxyRequestParser::handleStartElement(const std::string& element, const
} catch (boost::bad_lexical_cast &) {
port = -1;
}
- if (address.isValid() && port != -1 && jid.isValid()) {
+ if (!host.empty() && port != -1 && jid.isValid()) {
S5BProxyRequest::StreamHost streamHost;
- streamHost.addressPort = HostAddressPort(address, port);
+ streamHost.host = host;
+ streamHost.port = port;
streamHost.jid = jid;
getPayloadInternal()->setStreamHost(streamHost);
}