Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions .github/workflows/node-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
21 changes: 21 additions & 0 deletions impit/src/fingerprint/database/chrome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down
9 changes: 9 additions & 0 deletions impit/src/fingerprint/database/firefox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down Expand Up @@ -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),
}
}

Expand Down
3 changes: 3 additions & 0 deletions impit/src/fingerprint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ impl TlsFingerprint {
#[derive(Clone, Debug)]
pub struct Http2Fingerprint {
pub pseudo_header_order: Vec<String>,
pub initial_stream_window_size: Option<u32>,
pub initial_connection_window_size: Option<u32>,
pub max_header_list_size: Option<u32>,
}

/// TLS extensions configuration.
Expand Down
12 changes: 12 additions & 0 deletions impit/src/impit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ impl<CookieStoreImpl: CookieStore + 'static> Impit<CookieStoreImpl> {
// 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 {
Expand Down
Loading