diff --git a/modules/demux/adaptive/http/ConnectionParams.cpp b/modules/demux/adaptive/http/ConnectionParams.cpp
index 6e3f221b66fc967e273d803d5df30f266d203351..a60239d16d88b70e590c337a10d0784ff21bc9cb 100644
--- a/modules/demux/adaptive/http/ConnectionParams.cpp
+++ b/modules/demux/adaptive/http/ConnectionParams.cpp
@@ -70,8 +70,8 @@ void ConnectionParams::setPath(const std::string &path_)
     if(!hostname.empty())
     {
         os << hostname;
-        if( (port != 80 && scheme != "http") ||
-            (port != 443 && scheme != "https") )
+        if( (port != 80 && scheme == "http") ||
+            (port != 443 && scheme == "https") )
             os << ":" << port;
     }
     os << path;