mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-23 18:49:08 +08:00
Add new parameter curl_cookiefile for curl_easy_setopt
This allows OCR for URLs which require a session cookie. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
bb2af57054
commit
dd1c85dc1e
@ -101,6 +101,7 @@ static BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
|
||||
static STRING_VAR(document_title, "", "Title of output document (used for hOCR and PDF output)");
|
||||
#ifdef HAVE_LIBCURL
|
||||
static INT_VAR(curl_timeout, 0, "Timeout for curl in seconds");
|
||||
static STRING_VAR(curl_cookiefile, "", "File with cookie data for curl");
|
||||
#endif
|
||||
|
||||
/** Minimum sensible image size to be worth running Tesseract. */
|
||||
@ -1164,6 +1165,13 @@ bool TessBaseAPI::ProcessPagesInternal(const char *filename, const char *retry_c
|
||||
return error("curl_easy_setopt");
|
||||
}
|
||||
}
|
||||
std::string cookiefile = curl_cookiefile;
|
||||
if (!cookiefile.empty()) {
|
||||
curlcode = curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookiefile.c_str());
|
||||
if (curlcode != CURLE_OK) {
|
||||
return error("curl_easy_setopt");
|
||||
}
|
||||
}
|
||||
curlcode = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
|
||||
if (curlcode != CURLE_OK) {
|
||||
return error("curl_easy_setopt");
|
||||
|
Loading…
Reference in New Issue
Block a user