From 1b4831ae094f9a3739649f3eee522cbeb93bf35b Mon Sep 17 00:00:00 2001 From: Zapic Date: Mon, 8 Sep 2025 10:38:35 +0800 Subject: [PATCH] feat: enable network request compressing & decompressing --- src/xhr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xhr.c b/src/xhr.c index 9a980e80..7ca71201 100644 --- a/src/xhr.c +++ b/src/xhr.c @@ -349,6 +349,11 @@ static JSValue tjs_xhr_constructor(JSContext *ctx, JSValue new_target, int argc, curl_easy_setopt(x->curl_h, CURLOPT_WRITEDATA, x); curl_easy_setopt(x->curl_h, CURLOPT_HEADERFUNCTION, curl__header_cb); curl_easy_setopt(x->curl_h, CURLOPT_HEADERDATA, x); +#if LIBCURL_VERSION_NUM >= 0x071506 /* renamed from ENCODING to ACCEPT_ENCODING in 7.21.6 */ + curl_easy_setopt(x->curl_h, CURLOPT_ACCEPT_ENCODING, ""); +#else + curl_easy_setopt(x->curl_h, CURLOPT_ENCODING, ""); +#endif JS_SetOpaque(obj, x); return obj;