[vlc-devel] [PATCH 1/2] demux: adaptive: add missing port number in Host field

Zhao Zhili quinkblack at foxmail.com
Tue Sep 12 07:50:41 CEST 2017


---
  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 03156c6..74d2103 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();
-- 
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-adaptive-add-missing-port-number-in-Host-field.patch
Type: text/x-patch
Size: 1497 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170912/707af491/attachment.bin>


More information about the vlc-devel mailing list