@@ -1089,7 +1089,7 @@ index 03d1959e2..21b73b9b1 100644
10891089 }
10901090
10911091diff --git a/lib/http2.c b/lib/http2.c
1092- index 88fbcceb7..fcd1d2657 100644
1092+ index 88fbcceb7..94f7cd9b4 100644
10931093--- a/lib/http2.c
10941094+++ b/lib/http2.c
10951095@@ -51,6 +51,7 @@
@@ -1298,32 +1298,42 @@ index 88fbcceb7..fcd1d2657 100644
12981298 static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
12991299 struct Curl_easy *data);
13001300
1301- @@ -314,8 +458,22 @@ static CURLcode cf_h2_update_local_win(struct Curl_cfilter *cf,
1301+ @@ -314,8 +458,6 @@ static CURLcode cf_h2_update_local_win(struct Curl_cfilter *cf,
13021302 stream->id, dwsize - wsize);
13031303 }
13041304 else {
13051305- rv = nghttp2_session_set_local_window_size(ctx->h2, NGHTTP2_FLAG_NONE,
13061306- stream->id, dwsize);
1307- + // curl-impersonate:
1308- + // Directly changing the initial window update using users' settings.
1309- + int current_window_size = nghttp2_session_get_local_window_size(ctx->h2);
1310- +
1311- + // Use chrome's value as default
1312- + int window_update = 15663105;
1313- + if(data->set.http2_window_update) {
1314- + window_update = data->set.http2_window_update;
1315- + }
1316- +
1317- + // printf("Using window update %d\n", window_update);
1318- +
1319- + rv = nghttp2_session_set_local_window_size(
1320- + ctx->h2, NGHTTP2_FLAG_NONE, 0,
1321- + current_window_size + window_update);
1322- +
13231307 if(rv) {
13241308 failf(data, "[%d] nghttp2_session_set_local_window_size() failed: "
13251309 "%s(%d)", stream->id, nghttp2_strerror(rv), rv);
1326- @@ -610,6 +768,17 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf,
1310+ @@ -600,9 +742,23 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf,
1311+ goto out;
1312+ }
1313+ }
1314+ +
1315+ + // curl-impersonate:
1316+ + // Directly changing the initial window update using users' settings.
1317+ + int current_window_size = nghttp2_session_get_local_window_size(ctx->h2);
1318+ +
1319+ + // Use chrome's value as default
1320+ + int window_update = 15663105;
1321+ + if(data->set.http2_window_update) {
1322+ + window_update = data->set.http2_window_update;
1323+ + }
1324+ +
1325+ + // printf("Using window update %d\n", window_update);
1326+ +
1327+ + rc = nghttp2_session_set_local_window_size(
1328+ + ctx->h2, NGHTTP2_FLAG_NONE, 0,
1329+ + current_window_size + window_update);
1330+
1331+ - rc = nghttp2_session_set_local_window_size(ctx->h2, NGHTTP2_FLAG_NONE, 0,
1332+ - HTTP2_HUGE_WINDOW_SIZE);
1333+ if(rc) {
1334+ failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
1335+ nghttp2_strerror(rc), rc);
1336+ @@ -610,6 +766,17 @@ static CURLcode cf_h2_ctx_open(struct Curl_cfilter *cf,
13271337 goto out;
13281338 }
13291339
@@ -1341,7 +1351,7 @@ index 88fbcceb7..fcd1d2657 100644
13411351 /* all set, traffic will be send on connect */
13421352 result = CURLE_OK;
13431353 CURL_TRC_CF(data, cf, "[0] created h2 session%s",
1344- @@ -1925,11 +2094 ,19 @@ out:
1354+ @@ -1925,11 +2092 ,19 @@ out:
13451355 return rv;
13461356 }
13471357
@@ -1362,7 +1372,7 @@ index 88fbcceb7..fcd1d2657 100644
13621372 }
13631373
13641374 static int sweight_in_effect(const struct Curl_easy *data)
1365- @@ -1944,6 +2121 ,12 @@ static int sweight_in_effect(const struct Curl_easy *data)
1375+ @@ -1944,6 +2119 ,12 @@ static int sweight_in_effect(const struct Curl_easy *data)
13661376 * and dependency to the peer. It also stores the updated values in the state
13671377 * struct.
13681378 */
@@ -1375,7 +1385,7 @@ index 88fbcceb7..fcd1d2657 100644
13751385
13761386 static void h2_pri_spec(struct cf_h2_ctx *ctx,
13771387 struct Curl_easy *data,
1378- @@ -1952,6 +2135 ,11 @@ static void h2_pri_spec(struct cf_h2_ctx *ctx,
1388+ @@ -1952,6 +2133 ,11 @@ static void h2_pri_spec(struct cf_h2_ctx *ctx,
13791389 struct Curl_data_priority *prio = &data->set.priority;
13801390 struct h2_stream_ctx *depstream = H2_STREAM_CTX(ctx, prio->parent);
13811391 int32_t depstream_id = depstream ? depstream->id : 0;
@@ -1387,7 +1397,7 @@ index 88fbcceb7..fcd1d2657 100644
13871397 nghttp2_priority_spec_init(pri_spec, depstream_id,
13881398 sweight_wanted(data),
13891399 data->set.priority.exclusive);
1390- @@ -1971,20 +2159 ,24 @@ static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
1400+ @@ -1971,20 +2157 ,24 @@ static CURLcode h2_progress_egress(struct Curl_cfilter *cf,
13911401 struct h2_stream_ctx *stream = H2_STREAM_CTX(ctx, data);
13921402 int rv = 0;
13931403
@@ -1435,10 +1445,10 @@ index 93cc2d44f..52e80ce9c 100644
14351445 * Store nghttp2 version info in this buffer.
14361446diff --git a/lib/impersonate.c b/lib/impersonate.c
14371447new file mode 100644
1438- index 000000000..6116ace72
1448+ index 000000000..85e07dded
14391449--- /dev/null
14401450+++ b/lib/impersonate.c
1441- @@ -0,0 +1,1470 @@
1451+ @@ -0,0 +1,1408 @@
14421452+ #include "curl_setup.h"
14431453+
14441454+ #include <curl/curl.h>
@@ -2843,68 +2853,6 @@ index 000000000..6116ace72
28432853+ .tls_key_shares_limit = 3
28442854+ },
28452855+ {
2846- + .target = "firefox135",
2847- + .httpversion = CURL_HTTP_VERSION_2_0,
2848- + .ssl_version = CURL_SSLVERSION_TLSv1_2 | CURL_SSLVERSION_MAX_DEFAULT,
2849- + .ciphers =
2850- + "TLS_AES_128_GCM_SHA256,"
2851- + "TLS_CHACHA20_POLY1305_SHA256,"
2852- + "TLS_AES_256_GCM_SHA384,"
2853- + "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,"
2854- + "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,"
2855- + "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,"
2856- + "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,"
2857- + "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,"
2858- + "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,"
2859- + "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,"
2860- + "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,"
2861- + "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,"
2862- + "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,"
2863- + "TLS_RSA_WITH_AES_128_GCM_SHA256,"
2864- + "TLS_RSA_WITH_AES_256_GCM_SHA384,"
2865- + "TLS_RSA_WITH_AES_128_CBC_SHA,"
2866- + "TLS_RSA_WITH_AES_256_CBC_SHA",
2867- + .http_headers = {
2868- + "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:135.0) Gecko/20100101 Firefox/135.0",
2869- + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
2870- + "Accept-Language: en-US,en;q=0.5",
2871- + "Accept-Encoding: gzip, deflate, br, zstd",
2872- + "Upgrade-Insecure-Requests: 1",
2873- + "Sec-Fetch-Dest: document",
2874- + "Sec-Fetch-Mode: navigate",
2875- + "Sec-Fetch-Site: none",
2876- + "Sec-Fetch-User: ?1",
2877- + "Priority: u=0, i",
2878- + "Te: trailers"
2879- + },
2880- + .curves = "X25519MLKEM768:X25519:P-256:P-384:P-521:ffdhe2048:ffdhe3072",
2881- + .sig_hash_algs =
2882- + "ecdsa_secp256r1_sha256,"
2883- + "ecdsa_secp384r1_sha384,"
2884- + "ecdsa_secp521r1_sha512,"
2885- + "rsa_pss_rsae_sha256,"
2886- + "rsa_pss_rsae_sha384,"
2887- + "rsa_pss_rsae_sha512,"
2888- + "rsa_pkcs1_sha256,"
2889- + "rsa_pkcs1_sha384,"
2890- + "rsa_pkcs1_sha512,"
2891- + "ecdsa_sha1,"
2892- + "rsa_pkcs1_sha1",
2893- + .alpn = true,
2894- + .http2_settings = "1:65536;2:0;4:131072;5:16384",
2895- + .http2_window_update = 12517377,
2896- + .http2_pseudo_headers_order = "mpas",
2897- + .cert_compression = "zlib,brotli,zstd",
2898- + .ech = "grease",
2899- + .tls_session_ticket = true,
2900- + .tls_extension_order = "0-23-65281-10-11-35-16-5-34-18-51-43-13-45-28-27-65037",
2901- + .tls_delegated_credentials = "ecdsa_secp256r1_sha256:ecdsa_secp384r1_sha384:ecdsa_secp521r1_sha512:ecdsa_sha1",
2902- + .tls_record_size_limit = 4001,
2903- + .tls_grease = false,
2904- + .tls_signed_cert_timestamps = false,
2905- + .tls_key_shares_limit = 3
2906- + },
2907- + {
29082856+ /* Last one must be NULL. */
29092857+ .target = NULL
29102858+ }
0 commit comments