Fix Host header always having port 65535 when URI does not contain explicit port

This commit is contained in:
Janek Bevendorff 2017-02-15 21:48:58 +01:00
parent 9d5d3081dc
commit a0ebbf997d
2 changed files with 5 additions and 7 deletions

View File

@ -93,9 +93,8 @@ public:
}
void writeRaw(const QByteArray& data) {
if ( itcpSocket ) {
if ( itcpSocket )
itcpSocket->write(data);
}
else if ( ilocalSocket )
ilocalSocket->write(data);

View File

@ -82,12 +82,11 @@ void
QHttpRequestPrivate::prepareHeadersToWrite() {
if ( !iheaders.contains("host") ) {
quint16 port = iurl.port();
if ( port == 0 )
port = 80;
QString portStr = ( -1 != iurl.port() ) ?
QString(":%1").arg(iurl.port()) : "";
iheaders.insert("host",
QString("%1:%2").arg(iurl.host()).arg(port).toLatin1()
QString("%1%2").arg(iurl.host()).arg(portStr).toLatin1()
);
}
}