Skip to content

Commit

Permalink
Only set connection-timeout for connection manager if it's not NFS
Browse files Browse the repository at this point in the history
  • Loading branch information
phunkyfish committed Feb 7, 2024
1 parent 309ffb0 commit 6ba4476
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/iptvsimple/utilities/WebUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ bool WebUtils::IsHttpUrl(const std::string& url)
return StringUtils::StartsWith(url, HTTP_PREFIX) || StringUtils::StartsWith(url, HTTPS_PREFIX);
}

bool WebUtils::IsNfsUrl(const std::string& url)
{
return StringUtils::StartsWith(url, NFS_PREFIX);
}

std::string WebUtils::RedactUrl(const std::string& url)
{
std::string redactedUrl = url;
Expand Down Expand Up @@ -145,8 +150,8 @@ bool WebUtils::Check(const std::string& strURL, int connectionTimeoutSecs, bool
return false;
}

fileHandle.CURLAddOption(ADDON_CURL_OPTION_PROTOCOL, "connection-timeout",
std::to_string(connectionTimeoutSecs));
if (!IsNfsUrl(strURL))
fileHandle.CURLAddOption(ADDON_CURL_OPTION_PROTOCOL, "connection-timeout", std::to_string(connectionTimeoutSecs));

if (!fileHandle.CURLOpen(ADDON_READ_NO_CACHE))
{
Expand Down
2 changes: 2 additions & 0 deletions src/iptvsimple/utilities/WebUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace iptvsimple
{
static const std::string HTTP_PREFIX = "http://";
static const std::string HTTPS_PREFIX = "https://";
static const std::string NFS_PREFIX = "nfs://";
static const std::string UDP_MULTICAST_PREFIX = "udp://@";
static const std::string RTP_MULTICAST_PREFIX = "rtp://@";

Expand All @@ -26,6 +27,7 @@ namespace iptvsimple
static bool IsEncoded(const std::string& value);
static std::string ReadFileContentsStartOnly(const std::string& url, int* httpCode);
static bool IsHttpUrl(const std::string& url);
static bool IsNfsUrl(const std::string& url);
static std::string RedactUrl(const std::string& url);
static bool Check(const std::string& url, int connectionTimeoutSecs, bool isLocalPath = false);
};
Expand Down

0 comments on commit 6ba4476

Please sign in to comment.