elevenlabs to use http 1.1 (#57)

* elevenlabs to use http 1.1

Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>

* update the rest of mod tts

Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>

* add env variable for disabling http2

Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>

---------

Signed-off-by: Hoan HL <quan.luuhoang8@gmail.com>
This commit is contained in:
Hoan Luu Huu
2024-04-29 18:51:09 +07:00
committed by GitHub
parent 33fee93ec7
commit 916332d91d
6 changed files with 24 additions and 6 deletions

View File

@@ -876,7 +876,10 @@ extern "C" {
curl_easy_setopt(easy, CURLOPT_POSTFIELDS, conn->body);
//curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE, body.length());
curl_easy_setopt(easy, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
// libcurl adding random byte to the response body that creates white noise to audio file
// https://github.com/curl/curl/issues/10525
const bool disable_http_2 = switch_true(std::getenv("DISABLE_HTTP2_FOR_TTS_STREAMING"));
curl_easy_setopt(easy, CURLOPT_HTTP_VERSION, disable_http_2 ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_2_0);
rc = curl_multi_add_handle(global.multi, conn->easy);
mcode_test("new_conn: curl_multi_add_handle", rc);