Skip to content

Commit ba8b1a1

Browse files
authored
Stop enabling accept_encoding for all (#117)
1 parent 1f870d5 commit ba8b1a1

2 files changed

Lines changed: 7 additions & 59 deletions

File tree

patches/curl.patch

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ index fb162a30d..f1429fe2f 100644
392392
bool Curl_dynhds_contains(struct dynhds *dynhds,
393393
const char *name, size_t namelen);
394394
diff --git a/lib/easy.c b/lib/easy.c
395-
index aa1bedec3..4386e0bab 100644
395+
index aa1bedec3..c25631d77 100644
396396
--- a/lib/easy.c
397397
+++ b/lib/easy.c
398398
@@ -75,6 +75,8 @@
@@ -404,7 +404,7 @@ index aa1bedec3..4386e0bab 100644
404404

405405
#include "easy_lock.h"
406406

407-
@@ -344,6 +346,249 @@ CURLsslset curl_global_sslset(curl_sslbackend id, const char *name,
407+
@@ -344,6 +346,244 @@ CURLsslset curl_global_sslset(curl_sslbackend id, const char *name,
408408
return rc;
409409
}
410410

@@ -594,11 +594,6 @@ index aa1bedec3..4386e0bab 100644
594594
+ ret = curl_easy_setopt(data, CURLOPT_STREAM_EXCLUSIVE, opts->http2_stream_exclusive);
595595
+ }
596596
+
597-
+ /* FIXME: Always enable all supported compressions. */
598-
+ ret = curl_easy_setopt(data, CURLOPT_ACCEPT_ENCODING, "");
599-
+ if(ret)
600-
+ return ret;
601-
+
602597
+ return CURLE_OK;
603598
+}
604599
+
@@ -654,7 +649,7 @@ index aa1bedec3..4386e0bab 100644
654649
/*
655650
* curl_easy_init() is the external interface to alloc, setup and init an
656651
* easy handle that is returned. If anything goes wrong, NULL is returned.
657-
@@ -352,6 +597,8 @@ CURL *curl_easy_init(void)
652+
@@ -352,6 +592,8 @@ CURL *curl_easy_init(void)
658653
{
659654
CURLcode result;
660655
struct Curl_easy *data;
@@ -663,7 +658,7 @@ index aa1bedec3..4386e0bab 100644
663658

664659
/* Make sure we inited the global SSL stuff */
665660
global_init_lock();
666-
@@ -374,6 +621,29 @@ CURL *curl_easy_init(void)
661+
@@ -374,6 +616,29 @@ CURL *curl_easy_init(void)
667662
return NULL;
668663
}
669664

@@ -693,7 +688,7 @@ index aa1bedec3..4386e0bab 100644
693688
return data;
694689
}
695690

696-
@@ -1010,6 +1280,13 @@ CURL *curl_easy_duphandle(CURL *d)
691+
@@ -1010,6 +1275,13 @@ CURL *curl_easy_duphandle(CURL *d)
697692
outcurl->state.referer_alloc = TRUE;
698693
}
699694

@@ -707,7 +702,7 @@ index aa1bedec3..4386e0bab 100644
707702
/* Reinitialize an SSL engine for the new handle
708703
* note: the engine name has already been copied by dupset */
709704
if(outcurl->set.str[STRING_SSL_ENGINE]) {
710-
@@ -1096,6 +1373,9 @@ fail:
705+
@@ -1096,6 +1368,9 @@ fail:
711706
*/
712707
void curl_easy_reset(CURL *d)
713708
{
@@ -717,7 +712,7 @@ index aa1bedec3..4386e0bab 100644
717712
struct Curl_easy *data = d;
718713
Curl_req_hard_reset(&data->req, data);
719714

720-
@@ -1121,6 +1401,23 @@ void curl_easy_reset(CURL *d)
715+
@@ -1121,6 +1396,23 @@ void curl_easy_reset(CURL *d)
721716
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_DIGEST_AUTH)
722717
Curl_http_auth_cleanup_digest(data);
723718
#endif

tests/test_impersonate.py

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -348,53 +348,6 @@ async def test_http2_headers(
348348
assert equals, msg
349349

350350

351-
@pytest.mark.parametrize(
352-
"curl_binary, env_vars, ld_preload, expected_signature",
353-
CURL_BINARIES_AND_SIGNATURES,
354-
)
355-
def test_content_encoding(
356-
pytestconfig,
357-
curl_binary,
358-
env_vars,
359-
ld_preload,
360-
expected_signature,
361-
test_urls,
362-
):
363-
"""
364-
Ensure the output of curl-impersonate is correct, i.e. that compressed
365-
responses are decoded correctly.
366-
"""
367-
curl_binary = os.path.join(
368-
pytestconfig.getoption("install_dir"), "bin", curl_binary
369-
)
370-
if ld_preload:
371-
# Injecting libcurl-impersonate with LD_PRELOAD is supported on
372-
# Linux only. On Mac there is DYLD_INSERT_LIBRARIES but it
373-
# requires more work to be functional.
374-
if not sys.platform.startswith("linux"):
375-
pytest.skip()
376-
377-
_set_ld_preload(
378-
env_vars,
379-
os.path.join(pytestconfig.getoption("install_dir"), "lib", ld_preload),
380-
)
381-
382-
output = tempfile.mkstemp()[1]
383-
ret = _run_curl(
384-
curl_binary,
385-
env_vars=env_vars,
386-
extra_args=None,
387-
urls=[test_urls[0]],
388-
output=output,
389-
)
390-
assert ret == 0
391-
392-
with open(output, "r") as f:
393-
body = f.read()
394-
assert (
395-
"<!DOCTYPE html>" in body or "<html>" in body or "<!doctype html>" in body
396-
)
397-
398351

399352
@pytest.mark.parametrize(
400353
"curl_binary, env_vars, ld_preload",

0 commit comments

Comments
 (0)