diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index bbc77f4840..a21798429a 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -1144,6 +1144,10 @@ bool TessBaseAPI::ProcessPagesInternal(const char *filename, const char *retry_c if (curlcode != CURLE_OK) { return error("curl_easy_setopt"); } + curlcode = curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L); + if (curlcode != CURLE_OK) { + return error("curl_easy_setopt"); + } // Follow HTTP, HTTPS, FTP and FTPS redirects. curlcode = curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); if (curlcode != CURLE_OK) {