summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-09-17 11:52:40 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-09-17 18:01:27 (GMT)
commitd1aaf7fc9b9da32f04f84eef06bc0ee731e79223 (patch)
tree14ecd64cfd4b44e2664170983a5a0fefc47a03fd /Swift
parent3d6aa3b50090c19b50ae488494f1459bade88da3 (diff)
downloadswift-contrib-d1aaf7fc9b9da32f04f84eef06bc0ee731e79223.zip
swift-contrib-d1aaf7fc9b9da32f04f84eef06bc0ee731e79223.tar.bz2
Fixed URL parsing/serializing.
Resolves: #1157,#1158
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/MainController.cpp4
-rw-r--r--Swift/QtUI/QtConnectionSettingsWindow.cpp9
2 files changed, 7 insertions, 6 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index e441c7c..8b0b540 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -751,7 +751,7 @@ void MainController::handleQuitRequest() {
#define SERIALIZE_INT(option) result += boost::lexical_cast<std::string>(options.option); result += ",";
#define SERIALIZE_STRING(option) result += Base64::encode(createByteArray(options.option)); result += ",";
#define SERIALIZE_SAFE_STRING(option) result += safeByteArrayToString(Base64::encode(options.option)); result += ",";
-#define SERIALIZE_URL(option) SERIALIZE_STRING(option.getScheme()) SERIALIZE_STRING(option.getHost()) SERIALIZE_INT(option.getPort()) SERIALIZE_STRING(option.getPath())
+#define SERIALIZE_URL(option) SERIALIZE_STRING(option.toString())
std::string MainController::serializeClientOptions(const ClientOptions& options) {
std::string result;
@@ -791,7 +791,7 @@ std::string MainController::serializeClientOptions(const ClientOptions& options)
#define PARSE_INT(option, defaultValue) PARSE_INT_RAW(defaultValue); result.option = intVal;
#define PARSE_STRING(option) PARSE_STRING_RAW; result.option = stringVal;
#define PARSE_SAFE_STRING(option) PARSE_STRING_RAW; result.option = SafeString(createSafeByteArray(stringVal));
-#define PARSE_URL(option) {PARSE_STRING_RAW; std::string scheme = stringVal; PARSE_STRING_RAW; std::string host = stringVal; PARSE_INT_RAW(0); int port = intVal; PARSE_STRING_RAW; std::string path = stringVal; result.option = !scheme.empty() && !host.empty() ? URL(scheme, host, port, path) : URL();}
+#define PARSE_URL(option) {PARSE_STRING_RAW; result.option = URL::fromString(stringVal);}
ClientOptions MainController::parseClientOptions(const std::string& optionString) {
diff --git a/Swift/QtUI/QtConnectionSettingsWindow.cpp b/Swift/QtUI/QtConnectionSettingsWindow.cpp
index 56ac65f..5bc2754 100644
--- a/Swift/QtUI/QtConnectionSettingsWindow.cpp
+++ b/Swift/QtUI/QtConnectionSettingsWindow.cpp
@@ -127,11 +127,12 @@ ClientOptions QtConnectionSettingsWindow::getOptions() {
options.boshURL = URL::fromString(Q2PSTRING(ui.bosh_uri->text()));
if (ui.bosh_manualProxy->isChecked()) {
std::string host = Q2PSTRING(ui.bosh_manualProxyHost->text());
- int port = 80;
try {
- port = boost::lexical_cast<int>(Q2PSTRING(ui.bosh_manualProxyPort->text()));
- } catch (const boost::bad_lexical_cast&) {}
- options.boshHTTPConnectProxyURL = URL("http", host, port, "");
+ int port = boost::lexical_cast<int>(Q2PSTRING(ui.bosh_manualProxyPort->text()));
+ options.boshHTTPConnectProxyURL = URL("http", host, port, "");
+ } catch (const boost::bad_lexical_cast&) {
+ options.boshHTTPConnectProxyURL = URL("http", host, "");
+ }
}
}
}