Fix including http:// in the proxy URL:

The proxy host parsed incorrectly, when it was typed with a scheme (http or https).
Now proxy can be specified with the scheme.

Fix invalid type conversion:
m_proxyPort converts to its ASCII representation.
Use `QString::number` to include a proxy port properly.

Issues:
https://github.com/ariya/phantomjs/issues/11117
https://github.com/ariya/phantomjs/issues/10811
1.9
Vitaliy Slobodin 2013-05-27 23:59:42 +04:00 committed by Ariya Hidayat
parent f63815d4bc
commit 0cdd1ecc7a
1 changed files with 5 additions and 13 deletions

View File

@ -283,25 +283,17 @@ void Config::setProxyType(const QString value)
QString Config::proxy() const
{
return proxyHost() + ":" + proxyPort();
return m_proxyHost + ":" + QString::number(m_proxyPort);
}
void Config::setProxy(const QString &value)
{
QString proxyHost = value;
int proxyPort = 1080;
QUrl proxyUrl = QUrl::fromUserInput(value);
if (proxyHost.lastIndexOf(':') > 0) {
bool ok = true;
int port = proxyHost.mid(proxyHost.lastIndexOf(':') + 1).toInt(&ok);
if (ok) {
proxyHost = proxyHost.left(proxyHost.lastIndexOf(':')).trimmed();
proxyPort = port;
}
if (proxyUrl.isValid()) {
setProxyHost(proxyUrl.host());
setProxyPort(proxyUrl.port(1080));
}
setProxyHost(proxyHost);
setProxyPort(proxyPort);
}
void Config::setProxyAuth(const QString &value)