diff --git a/cmake b/cmake index 81c22387b..00d6d609c 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 81c22387bfcc2251a49f8eb8d0e7ae181dca2b47 +Subproject commit 00d6d609ce62eabcdc402d21d1f8b47bb4dbff15 diff --git a/src/crypto/Connect.h b/src/crypto/Connect.h index 3bf4881da..4083637c6 100644 --- a/src/crypto/Connect.h +++ b/src/crypto/Connect.h @@ -35,6 +35,10 @@ class Connect struct Result { std::string result, content; std::map headers; + bool isOK() const + { + return result.find("200") != std::string::npos; + } bool isRedirect() const { return result.find("301") != std::string::npos || diff --git a/src/crypto/TSL.cpp b/src/crypto/TSL.cpp index 484719ddf..c59e40a91 100644 --- a/src/crypto/TSL.cpp +++ b/src/crypto/TSL.cpp @@ -259,6 +259,8 @@ TSL::Result TSL::parse(const string &url, const vector &certs, Connect::Result r = Connect(url, "GET", timeout).exec({{"Accept-Encoding", "gzip"}}, vector()); if(r.isRedirect()) r = Connect(r.headers["Location"], "GET", timeout).exec({{"Accept-Encoding", "gzip"}}, vector()); + if(!r.isOK() || r.content.empty()) + THROW("HTTP status code is not 200 or content is empty"); file << r.content; file.close();