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

This commit is contained in:
Janek Bevendorff committed 2017-02-17 02:43:25 +01:00
1 parent 9d5d3081dc
commit a0ebbf997d
2 files changed
+5 -7

No files matched your search

+1 -2
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);
+4 -5
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()
);
}
}