mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
macOS 10.13
This commit is contained in:
@@ -36,36 +36,36 @@ std::string FileGet::escape_url(const std::string& unescaped)
|
|||||||
bool FileGet::is_subdomain(const std::string& url, const std::string& domain)
|
bool FileGet::is_subdomain(const std::string& url, const std::string& domain)
|
||||||
{
|
{
|
||||||
// domain should be f.e. printables.com (.com including)
|
// domain should be f.e. printables.com (.com including)
|
||||||
char* host;
|
// char* host;
|
||||||
std::string host_string;
|
// std::string host_string;
|
||||||
CURLUcode rc;
|
// CURLUcode rc;
|
||||||
CURLU* curl = curl_url();
|
// CURLU* curl = curl_url();
|
||||||
if (!curl) {
|
// if (!curl) {
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to init Curl library in function is_domain.";
|
// BOOST_LOG_TRIVIAL(error) << "Failed to init Curl library in function is_domain.";
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
rc = curl_url_set(curl, CURLUPART_URL, url.c_str(), 0);
|
// rc = curl_url_set(curl, CURLUPART_URL, url.c_str(), 0);
|
||||||
if (rc != CURLUE_OK) {
|
// if (rc != CURLUE_OK) {
|
||||||
curl_url_cleanup(curl);
|
// curl_url_cleanup(curl);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
rc = curl_url_get(curl, CURLUPART_HOST, &host, 0);
|
// rc = curl_url_get(curl, CURLUPART_HOST, &host, 0);
|
||||||
if (rc != CURLUE_OK || !host) {
|
// if (rc != CURLUE_OK || !host) {
|
||||||
curl_url_cleanup(curl);
|
// curl_url_cleanup(curl);
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
host_string = std::string(host);
|
// host_string = std::string(host);
|
||||||
curl_free(host);
|
// curl_free(host);
|
||||||
// now host should be subdomain.domain or just domain
|
// // now host should be subdomain.domain or just domain
|
||||||
if (domain == host_string) {
|
// if (domain == host_string) {
|
||||||
curl_url_cleanup(curl);
|
// curl_url_cleanup(curl);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
if(boost::ends_with(host_string, "." + domain)) {
|
// if(boost::ends_with(host_string, "." + domain)) {
|
||||||
curl_url_cleanup(curl);
|
// curl_url_cleanup(curl);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
curl_url_cleanup(curl);
|
// curl_url_cleanup(curl);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user