Add --compressed flag by default

Similar to https://github.com/lwthiker/curl-impersonate/pull/5
This commit is contained in:
lwthiker
2022-02-19 14:55:50 +02:00
parent 367f91922d
commit 1b41b6de84

View File

@@ -3,11 +3,6 @@
# Find the directory of this script
dir=`echo "$0" | sed 's%/[^/]*$%%'`
PIPE=/tmp/curl-pipe
rm -f "$PIPE" && mkfifo "$PIPE"
exec 5<>"$PIPE" 3>"$PIPE" 4<"$PIPE" 5>&-
# The list of ciphers can be obtained by looking at the Client Hello message in
# Wireshark, then converting it using this reference
# https://wiki.mozilla.org/Security/Cipher_Suites
@@ -25,16 +20,5 @@ exec 5<>"$PIPE" 3>"$PIPE" 4<"$PIPE" 5>&-
-H 'Sec-Fetch-Dest: document' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.9' \
--http2 --false-start --tlsv1.2 \
$@ >&3
exec 3>&-
IFS= read -d '' -r -n 2 -u 4 header
# Due to the "Accept-Encoding: gzip" header, we may receive a gzipped file.
if [ "$(echo -n $header | xxd -l 2 -p)" == "1f8b" ]; then
(printf "%s" "$header"; cat <&4) | gzip -cd;
else
printf "%s" "$header"; cat <&4;
fi
--http2 --false-start --tlsv1.2 --compressed \
$@