escl: Follow the 302 redirects

Recent ipp-usb redirects from http://127.0.0.1 to http://localhost
merge-requests/652/head
Jindřich Makovička 2021-02-14 13:16:48 +01:00
rodzic 65b6684984
commit 1b5344ba56
5 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -554,6 +554,8 @@ escl_capabilities(ESCL_Device *device, char *blacklist, SANE_Status *status)
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var);
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback);
curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)header);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
CURLcode res = curl_easy_perform(curl_handle);
if (res == CURLE_OK)
DBG( 1, "Create NewJob : the scanner header responded : [%s]\n", header->memory);

Wyświetl plik

@ -277,6 +277,8 @@ wake_up_device:
curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, upload->size);
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, download_callback);
curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)download);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
CURLcode res = curl_easy_perform(curl_handle);
if (res != CURLE_OK) {
DBG( 1, "Create NewJob : the scanner responded incorrectly: %s\n", curl_easy_strerror(res));

Wyświetl plik

@ -62,6 +62,8 @@ CURL_CALL:
scan_jobs, scanJob, result, scanner_start);
escl_curl_url(curl_handle, device, scan_cmd);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
if (curl_easy_perform(curl_handle) == CURLE_OK) {
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &answer);
i++;

Wyświetl plik

@ -74,6 +74,8 @@ escl_scan(capabilities_t *scanner, const ESCL_Device *device, char *scanJob, cha
scan_jobs, scanJob, result, scanner_start);
escl_curl_url(curl_handle, device, scan_cmd);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
if (scanner->tmp)
fclose(scanner->tmp);
scanner->tmp = tmpfile();

Wyświetl plik

@ -220,6 +220,8 @@ reload:
escl_curl_url(curl_handle, device, scanner_status);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, memory_callback_s);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var);
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L);
CURLcode res = curl_easy_perform(curl_handle);
if (res != CURLE_OK) {
DBG( 1, "The scanner didn't respond: %s\n", curl_easy_strerror(res));