handle better situation when no data read

This commit is contained in:
VaclavT 2021-02-11 23:40:47 +01:00
parent 36dece23b7
commit 1e5a421107
1 changed files with 5 additions and 0 deletions

View File

@ -66,7 +66,12 @@ std::pair<int, std::string> HttpClient::doGetRequest(const std::string &url, con
std::string request = "GET " + full_url + " HTTP/1.0\r\nHost: " + server + headers_string + "\r\n\r\n";
// TODO memory leaks ???
int bytes_read = sslRequest(server, request);
if (bytes_read <= 0) {
std::cerr << "no data read" << std::endl;
return std::make_pair(403, "");
}
std::string::size_type position = ssl_read_packet.find("\r\n\r\n");
if (position == std::string::npos) {