Commit 670e511f authored by Joris Guisson's avatar Joris Guisson
Browse files

Backport rev 977254

from trunk

svn path=/branches/stable/extragear-kde4/network/ktorrent/; revision=977255
parent 91389341
......@@ -35,14 +35,17 @@ namespace bt
void HTTPAnnounceJob::start()
{
http->setHost(url.host(),url.protocol() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp,url.port(80));
QHttp::ConnectionMode mode = url.protocol() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
quint16 port = url.port() < 0 ? 0 : url.port();
quint16 default_port = mode == QHttp::ConnectionModeHttps ? 443 : 80;
http->setHost(url.host(),mode,port);
if (!proxy_host.isEmpty() && proxy_port > 0)
http->setProxy(proxy_host,proxy_port);
QHttpRequestHeader hdr("GET",url.encodedPathAndQuery(),1,1);
hdr.setValue("User-Agent",bt::GetVersionString());
hdr.setValue("Connection","close");
hdr.setValue("Host",QString("%1:%2").arg(url.host()).arg(url.port(80)));
hdr.setValue("Host",QString("%1:%2").arg(url.host()).arg(url.port(default_port)));
get_id = http->request(hdr,0,&output);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment