diff --git a/.github/workflows/node-test.yaml b/.github/workflows/node-test.yaml index 1ee4d53..00fb04b 100644 --- a/.github/workflows/node-test.yaml +++ b/.github/workflows/node-test.yaml @@ -44,15 +44,15 @@ jobs: target: aarch64-unknown-linux-musl docker: arm64v8/node:20-alpine build: |- - export PATH="/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static --cfg reqwest_unstable" CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=gcc CC=gcc CXX="g++" GN_EXE=gn && - apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 gcc g++ perl && - sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && - apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing rustup git gn tar ninja && - apk update && - apk upgrade && - rustup-init -y && - yarn global add pnpm lerna && - corepack enable && + export PATH="/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static --cfg reqwest_unstable" CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=gcc CC=gcc CXX="g++" GN_EXE=gn + apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 gcc g++ perl + sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories + apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing rustup git gn tar ninja + apk update + apk upgrade + rustup-init -y + yarn global add pnpm lerna + corepack enable yarn --cwd impit-node build - host: ubuntu-22.04-arm target: aarch64-unknown-linux-gnu @@ -62,23 +62,23 @@ jobs: docker: node:20-alpine # Script taken from https://github.com/napi-rs/napi-rs/blob/main/alpine.Dockerfile build: | - export PATH="/aarch64-linux-musl-cross/bin:/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static --cfg reqwest_unstable" CC="clang" CXX="clang++" GN_EXE=gn && - apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 && - sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && - apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing rustup git gn tar ninja && - apk update && - apk upgrade && - rustup-init -y && - yarn global add pnpm lerna && - rustup target add aarch64-unknown-linux-musl && - wget https://github.com/napi-rs/napi-rs/releases/download/linux-musl-cross%4010/aarch64-linux-musl-cross.tgz && - tar -xvf aarch64-linux-musl-cross.tgz && - rm aarch64-linux-musl-cross.tgz && - apk add perl && - ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/crtbeginS.o /usr/lib/crtbeginS.o && - ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/crtendS.o /usr/lib/crtendS.o && - ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/libgcc.a /usr/lib/libgcc.a && - corepack enable && + export PATH="/aarch64-linux-musl-cross/bin:/usr/local/cargo/bin/rustup:/root/.cargo/bin:$PATH" RUSTFLAGS="-C target-feature=-crt-static --cfg reqwest_unstable" CC="clang" CXX="clang++" GN_EXE=gn + apk add --update --no-cache bash wget cmake musl-dev clang llvm build-base python3 + sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories + apk add --update --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing rustup git gn tar ninja + apk update + apk upgrade + rustup-init -y + yarn global add pnpm lerna + rustup target add aarch64-unknown-linux-musl + wget https://github.com/napi-rs/napi-rs/releases/download/linux-musl-cross%4010/aarch64-linux-musl-cross.tgz + tar -xvf aarch64-linux-musl-cross.tgz + rm aarch64-linux-musl-cross.tgz + apk add perl + ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/crtbeginS.o /usr/lib/crtbeginS.o + ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/crtendS.o /usr/lib/crtendS.o + ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/libgcc.a /usr/lib/libgcc.a + corepack enable yarn --cwd impit-node build --target x86_64-unknown-linux-musl - host: macos-latest target: aarch64-apple-darwin @@ -147,7 +147,7 @@ jobs: cache-dependency-path: impit-node/yarn.lock architecture: x86 - name: Build in docker - uses: addnab/docker-run-action@v3 + uses: maus007/docker-run-action-fork@207a4e2a8ebf7e4b985656ba990b1e53715dce2a if: ${{ matrix.settings.docker }} with: image: ${{ matrix.settings.docker }} diff --git a/.github/workflows/python-test.yaml b/.github/workflows/python-test.yaml index 8576830..e10b614 100644 --- a/.github/workflows/python-test.yaml +++ b/.github/workflows/python-test.yaml @@ -187,7 +187,7 @@ jobs: - name: pytest if: ${{ startsWith(matrix.platform.target, 'x86_64') }} - uses: addnab/docker-run-action@v3 + uses: maus007/docker-run-action-fork@207a4e2a8ebf7e4b985656ba990b1e53715dce2a with: image: alpine:latest options: -v ${{ github.workspace }}:/io -w /io/impit-python -e APIFY_HTTPBIN_TOKEN=${{ secrets.APIFY_HTTPBIN_TOKEN }} diff --git a/impit/src/fingerprint/database/chrome.rs b/impit/src/fingerprint/database/chrome.rs index c523c3b..47848f3 100644 --- a/impit/src/fingerprint/database/chrome.rs +++ b/impit/src/fingerprint/database/chrome.rs @@ -117,6 +117,9 @@ pub mod chrome_142 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } @@ -255,6 +258,9 @@ pub mod chrome_136 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } @@ -387,6 +393,9 @@ pub mod chrome_133 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } @@ -519,6 +528,9 @@ pub mod chrome_124 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } @@ -654,6 +666,9 @@ pub mod chrome_131 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } @@ -783,6 +798,9 @@ pub mod chrome_100 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } @@ -1081,6 +1099,9 @@ pub mod chrome_125 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(6_291_456), + initial_connection_window_size: Some(15_663_105), + max_header_list_size: Some(262_144), } } diff --git a/impit/src/fingerprint/database/firefox.rs b/impit/src/fingerprint/database/firefox.rs index dd9e36a..0f6c212 100644 --- a/impit/src/fingerprint/database/firefox.rs +++ b/impit/src/fingerprint/database/firefox.rs @@ -120,6 +120,9 @@ pub mod firefox_128 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(131_072), + initial_connection_window_size: Some(12_517_377), + max_header_list_size: Some(65_536), } } @@ -258,6 +261,9 @@ pub mod firefox_133 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(131_072), + initial_connection_window_size: Some(12_517_377), + max_header_list_size: Some(65_536), } } @@ -401,6 +407,9 @@ pub mod firefox_135 { ":protocol".to_string(), ":status".to_string(), ], + initial_stream_window_size: Some(131_072), + initial_connection_window_size: Some(12_517_377), + max_header_list_size: Some(65_536), } } diff --git a/impit/src/fingerprint/mod.rs b/impit/src/fingerprint/mod.rs index 54e2d45..ab260cc 100644 --- a/impit/src/fingerprint/mod.rs +++ b/impit/src/fingerprint/mod.rs @@ -70,6 +70,9 @@ impl TlsFingerprint { #[derive(Clone, Debug)] pub struct Http2Fingerprint { pub pseudo_header_order: Vec, + pub initial_stream_window_size: Option, + pub initial_connection_window_size: Option, + pub max_header_list_size: Option, } /// TLS extensions configuration. diff --git a/impit/src/impit.rs b/impit/src/impit.rs index f52f796..d48f48a 100644 --- a/impit/src/impit.rs +++ b/impit/src/impit.rs @@ -238,6 +238,18 @@ impl Impit { // Use fingerprint if provided, otherwise fall back to browser enum if let Some(ref fingerprint) = config.fingerprint { tls_config_builder.with_tls_fingerprint(fingerprint.tls.clone()); + + if let Some(window_size) = fingerprint.http2.initial_stream_window_size { + client = client.http2_initial_stream_window_size(window_size); + } + + if let Some(window_size) = fingerprint.http2.initial_connection_window_size { + client = client.http2_initial_connection_window_size(window_size); + } + + if let Some(max_size) = fingerprint.http2.max_header_list_size { + client = client.http2_max_header_list_size(max_size); + } } if config.max_http_version == Version::HTTP_3 {