diff --git a/config.def.h b/config.def.h index 5643df7..2e6d37f 100644 --- a/config.def.h +++ b/config.def.h @@ -9,6 +9,8 @@ You should have received a copy of the GNU General Public License along with thi © 2021 dogeystamp */ +#include + typedef struct { const char *url; const char *feedName; @@ -44,5 +46,9 @@ static const int logLevel = 3; // Use 0 to disable redirects, and -1 for no limit. static const int maxRedirs = 10; +// Restrict allowed protocols for curl using a bitmask. +// For more information: https://curl.se/libcurl/c/CURLOPT_PROTOCOLS.html +static const int curlProtocols = CURLPROTO_HTTPS | CURLPROTO_HTTP; + // File extension used for each article. static const char fileExt[] = ".html"; diff --git a/minrss.c b/minrss.c index 92fce82..0f6f265 100644 --- a/minrss.c +++ b/minrss.c @@ -93,7 +93,7 @@ finish(char *url, long responseCode) if (responseCode == 200) logMsg(4, "Finished downloading %s\n", url); else if (!responseCode) - logMsg(1, "Can not reach %s\n", url); + logMsg(1, "Can not reach %s: ensure the protocol is enabled and the site is accessible.\n", url); else logMsg(1, "HTTP %ld for %s\n", responseCode, url); } diff --git a/net.c b/net.c index 3d6ade5..4b49bba 100644 --- a/net.c +++ b/net.c @@ -73,6 +73,7 @@ createRequest(const char* url, outputStruct *output) stat = curl_easy_setopt(requestHandle, CURLOPT_WRITEFUNCTION, writeCallback); stat = curl_easy_setopt(requestHandle, CURLOPT_WRITEDATA, (void*)output); stat = curl_easy_setopt(requestHandle, CURLOPT_MAXREDIRS, maxRedirs); + stat = curl_easy_setopt(requestHandle, CURLOPT_PROTOCOLS, curlProtocols); stat = curl_easy_setopt(requestHandle, CURLOPT_FOLLOWLOCATION, 1L); if (stat) {