mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2026-09-02 07:00:32 +00:00
Add --compressed flag by default
Similar to https://github.com/lwthiker/curl-impersonate/pull/5
This commit is contained in:
@@ -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 \
|
||||
$@
|
||||
|
||||
Reference in New Issue
Block a user