summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/configure.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-06-25 17:21:06 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-06-25 17:21:06 +0000
commita3875d7dfe94906c95914840149afbb9944b719f (patch)
treebe7237f7da2ed8dafa7f2efe31da84ee3df763e5 /rbutil/rbutilqt/configure.cpp
parentdfd4183a7da257a1df9979c3ced830cfd5f1e6e3 (diff)
downloadrockbox-a3875d7dfe94906c95914840149afbb9944b719f.tar.gz
rockbox-a3875d7dfe94906c95914840149afbb9944b719f.tar.bz2
rockbox-a3875d7dfe94906c95914840149afbb9944b719f.zip
Rockbox Utility: fix proxy password getting lost (FS#12166).
The proxy settings are stored as string representation in the configuration file. If username / password contains characters used as separators parsing the string again will cause wrong results. Percent-encode them before storing, and parse it as percent-encoded string when reading it back. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30071 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/configure.cpp')
-rw-r--r--rbutil/rbutilqt/configure.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 50af453649..35654f8711 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -121,7 +121,16 @@ void Config::accept()
proxy.setPort(ui.proxyPort->text().toInt());
}
- RbSettings::setValue(RbSettings::Proxy, proxy.toString());
+ // QUrl::toEncoded() doesn't encode a colon in the password correctly,
+ // which will result in errors during parsing the string.
+ // QUrl::toPercentEncoding() does work as expected, so build the string to
+ // store in the configuration file manually.
+ QString proxystring = "http://"
+ + QString(QUrl::toPercentEncoding(proxy.userName())) + ":"
+ + QString(QUrl::toPercentEncoding(proxy.password())) + "@"
+ + proxy.host() + ":"
+ + QString::number(proxy.port());
+ RbSettings::setValue(RbSettings::Proxy, proxystring);
qDebug() << "[Config] setting proxy to:" << proxy;
// proxy type
QString proxyType;
@@ -218,7 +227,7 @@ void Config::abort()
void Config::setUserSettings()
{
// set proxy
- proxy = RbSettings::value(RbSettings::Proxy).toString();
+ proxy.setEncodedUrl(RbSettings::value(RbSettings::Proxy).toByteArray());
if(proxy.port() > 0)
ui.proxyPort->setText(QString("%1").arg(proxy.port()));