diff options
Diffstat (limited to 'Swiften/Network')
-rw-r--r-- | Swiften/Network/BOSHConnection.cpp | 8 | ||||
-rw-r--r-- | Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp | 4 | ||||
-rw-r--r-- | Swiften/Network/UnitTest/BOSHConnectionTest.cpp | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp index 73f8ed6..4741549 100644 --- a/Swiften/Network/BOSHConnection.cpp +++ b/Swiften/Network/BOSHConnection.cpp @@ -101,8 +101,12 @@ std::pair<SafeByteArray, size_t> BOSHConnection::createHTTPRequest(const SafeByt size = safeContent.size(); - header << "POST /" << boshURL.getPath() << " HTTP/1.1\r\n" - << "Host: " << boshURL.getHost() << ":" << boshURL.getPort() << "\r\n" + header << "POST " << boshURL.getPath() << " HTTP/1.1\r\n" + << "Host: " << boshURL.getHost(); + if (boshURL.getPort()) { + header << ":" << *boshURL.getPort(); + } + header << "\r\n" /*<< "Accept-Encoding: deflate\r\n"*/ << "Content-Type: text/xml; charset=utf-8\r\n" << "Content-Length: " << size << "\r\n\r\n"; diff --git a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp index 82762c5..7a2f0e6 100644 --- a/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp +++ b/Swiften/Network/UnitTest/BOSHConnectionPoolTest.cpp @@ -47,7 +47,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { public: void setUp() { to = "wonderland.lit"; - path = "http-bind"; + path = "/http-bind"; port = "5280"; sid = "MyShinySID"; initial = "<body wait='60' " @@ -236,7 +236,7 @@ class BOSHConnectionPoolTest : public CppUnit::TestFixture { void testSession() { to = "prosody.doomsong.co.uk"; resolver->addAddress("prosody.doomsong.co.uk", HostAddress("127.0.0.1")); - path = "http-bind/"; + path = "/http-bind/"; boshURL = URL("http", to, 5280, path); PoolRef testling = createTestling(); diff --git a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp index 31aed1b..7ef0249 100644 --- a/Swiften/Network/UnitTest/BOSHConnectionTest.cpp +++ b/Swiften/Network/UnitTest/BOSHConnectionTest.cpp @@ -193,7 +193,7 @@ class BOSHConnectionTest : public CppUnit::TestFixture { BOSHConnection::ref createTestling() { resolver->addAddress("wonderland.lit", HostAddress("127.0.0.1")); Connector::ref connector = Connector::create("wonderland.lit", 5280, false, resolver, connectionFactory, timerFactory); - BOSHConnection::ref c = BOSHConnection::create(URL("http", "wonderland.lit", 5280, "http-bind"), connector, &parserFactory); + BOSHConnection::ref c = BOSHConnection::create(URL("http", "wonderland.lit", 5280, "/http-bind"), connector, &parserFactory); c->onConnectFinished.connect(boost::bind(&BOSHConnectionTest::handleConnectFinished, this, _1)); c->onDisconnected.connect(boost::bind(&BOSHConnectionTest::handleDisconnected, this, _1)); c->onXMPPDataRead.connect(boost::bind(&BOSHConnectionTest::handleDataRead, this, _1)); |