thieleundklose / autotranslate

GNU General Public License v2.0
3 stars 2 forks source link

Not working without SSL certificate #12

Closed SventB closed 1 month ago

SventB commented 3 months ago

In my local DEV environment, saving the site configuration is not working, I get an error:

in \typo3conf\ext\autotranslate\Resources\Private\Deeplcom\DeeplPhp\src\HttpClient.php line 212

#60 DeepL\ConnectionException

SSL certificate problem: unable to get local issuer certificate

I have no SSL certificate here.

But seems to be a problem of DeepL PHP library.

mikezimmer-tuk commented 1 month ago

Hi Sven, could you check if this bug is still present? I Checked it without an ssl certificate, but al seems to be fine.

Best regards, Mike

SventB commented 1 month ago

Yes, problem still present with version 1.0.3 of EXT:autotranslate.

Error coming up when editing site configuration:

(1/1) #60 DeepL\ConnectionException

SSL certificate problem: unable to get local issuer certificate
in \typo3conf\ext\autotranslate\Resources\Private\Deeplcom\DeeplPhp\src\HttpClient.php line 212

                default:
                    $shouldRetry = false;
                    break;
            }
            throw new ConnectionException($errorMessage, $errorCode, null, $shouldRetry);
        }
    }

    private function shouldRetry(?array $response, ?ConnectionException $exception): bool

at DeepL\HttpClient->sendRequest('GET', 'https://api-free.deepl.com/v2/languages', 10.0, array('Authorization' => 'DeepL-Auth-Key xyz:fx', 'User-Agent' => 'deepl-php/1.4.0 (Windows NT) php/7.4.33'), array('type' => 'target'), null, null)
in \typo3conf\ext\autotranslate\Resources\Private\Deeplcom\DeeplPhp\src\HttpClient.php line 84

            $timeout = max($this->minTimeout, $backoff->getTimeUntilDeadline());
            $response = null;
            $exception = null;
            try {
                $response = $this->sendRequest($method, $url, $timeout, $headers, $params, $file, $outFile);
            } catch (ConnectionException $e) {
                $exception = $e;
            }

at DeepL\HttpClient->sendRequestWithBackoff('GET', 'https://api-free.deepl.com/v2/languages', array('params' => array('type' => 'target')))
mikezimmer-tuk commented 1 month ago

@SventB I've just checked the problem. It is not possible to call the DeepL API without https. A call without https ends in a 301 redirect. I would close the issue because of this.