[vlc-commits] demux: adaptive: add missing port number in Host field

Zhao Zhili git at videolan.org
Tue Sep 12 15:38:42 CEST 2017


vlc | branch: master | Zhao Zhili <wantlamy at gmail.com> | Tue Sep 12 11:55:56 2017 +0800| [ff75432ed4e0cc10452bd609f1ec597dde1e7571] | committer: Francois Cartegnie

demux: adaptive: add missing port number in Host field

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ff75432ed4e0cc10452bd609f1ec597dde1e7571
---

 modules/demux/adaptive/http/HTTPConnection.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp b/modules/demux/adaptive/http/HTTPConnection.cpp
index 03156c634a..74d2103438 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -363,9 +363,17 @@ void HTTPConnection::onHeader(const std::string &key,
 std::string HTTPConnection::buildRequestHeader(const std::string &path) const
 {
     std::stringstream req;
-    req << "GET " << path << " HTTP/1.1\r\n" <<
-           "Host: " << params.getHostname() << "\r\n" <<
-           "Cache-Control: no-cache" << "\r\n" <<
+    req << "GET " << path << " HTTP/1.1\r\n";
+    if((params.getScheme() == "http" && params.getPort() != 80) ||
+            (params.getScheme() == "https" && params.getPort() != 443))
+    {
+        req << "Host: " << params.getHostname() << ":" << params.getPort() << "\r\n";
+    }
+    else
+    {
+        req << "Host: " << params.getHostname() << "\r\n";
+    }
+    req << "Cache-Control: no-cache" << "\r\n" <<
            "User-Agent: " << std::string(psz_useragent) << "\r\n";
     req << extraRequestHeaders();
     return req.str();



More information about the vlc-commits mailing list