From 9c1c9481d5fc1b2c350aeb9a5501592c0012b1a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:49:11 +0000 Subject: [PATCH 1/2] Initial plan From 613aa652373de35131dce6fe9cc0693a0d2371be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:52:15 +0000 Subject: [PATCH 2/2] chore: remove impit-cli from the repository Co-authored-by: barjin <61918049+barjin@users.noreply.github.com> --- .github/workflows/cli-release.yaml | 163 ----------------------------- Cargo.lock | 141 +------------------------ Cargo.toml | 1 - README.md | 2 - impit-cli/Cargo.toml | 13 --- impit-cli/src/headers.rs | 15 --- impit-cli/src/main.rs | 145 ------------------------- impit/README.md | 2 - impit/src/lib.rs | 2 - 9 files changed, 2 insertions(+), 482 deletions(-) delete mode 100644 .github/workflows/cli-release.yaml delete mode 100644 impit-cli/Cargo.toml delete mode 100644 impit-cli/src/headers.rs delete mode 100644 impit-cli/src/main.rs diff --git a/.github/workflows/cli-release.yaml b/.github/workflows/cli-release.yaml deleted file mode 100644 index fda0d01a..00000000 --- a/.github/workflows/cli-release.yaml +++ /dev/null @@ -1,163 +0,0 @@ -# This file was 1:1 taken from https://github.com/houseabsolute/precious. Check it out! -name: "[impit-cli] Test & Build" - -on: - push: - branches: - - "master" - tags: - - "cli-*" - paths: - - "impit-cli/**" - - "impit/**" - pull_request: - paths: - - "impit-cli/**" - - "impit/**" - - Cargo.toml - - Cargo.lock - workflow_dispatch: - -env: - CRATE_NAME: impit-cli - GITHUB_TOKEN: ${{ github.token }} - RUST_BACKTRACE: 1 - -jobs: - test: - name: ${{ matrix.platform.os-name }} with rust ${{ matrix.toolchain }} - runs-on: ${{ matrix.platform.runs-on }} - strategy: - fail-fast: false - matrix: - platform: - # Platforms that don't work: - # - # - sparc64-unknown-linux-gnu - cannot compile openssl-sys - # - x86_64-unknown-illumos - weird error compiling openssl - "bin/sh: 1: granlib: not found" - - # - os-name: FreeBSD-x86_64 - # runs-on: ubuntu-24.04 - # target: x86_64-unknown-freebsd - # bin: impit-cli - # name: impit-cli-FreeBSD-x86_64.tar.gz - # skip_tests: true - - os-name: Linux-x86_64 - runs-on: ubuntu-24.04 - target: x86_64-unknown-linux-musl - bin: impit-cli - name: impit-cli-Linux-x86_64-musl.tar.gz - - os-name: Linux-aarch64 - runs-on: ubuntu-24.04 - target: aarch64-unknown-linux-musl - bin: impit-cli - name: impit-cli-Linux-aarch64-musl.tar.gz - - os-name: Linux-arm - runs-on: ubuntu-24.04 - target: arm-unknown-linux-musleabi - bin: impit-cli - name: impit-cli-Linux-arm-musl.tar.gz - # - os-name: Linux-i686 - # runs-on: ubuntu-24.04 - # target: i686-unknown-linux-musl - # bin: impit-cli - # name: impit-cli-Linux-i686-musl.tar.gz - # skip_tests: true - # - os-name: Linux-powerpc - # runs-on: ubuntu-24.04 - # target: powerpc-unknown-linux-gnu - # bin: impit-cli - # name: impit-cli-Linux-powerpc-gnu.tar.gz - # skip_tests: true - # - os-name: Linux-powerpc64 - # runs-on: ubuntu-24.04 - # target: powerpc64-unknown-linux-gnu - # bin: impit-cli - # name: impit-cli-Linux-powerpc64-gnu.tar.gz - # skip_tests: true - # - os-name: Linux-powerpc64le - # runs-on: ubuntu-24.04 - # target: powerpc64le-unknown-linux-gnu - # bin: impit-cli - # name: impit-cli-Linux-powerpc64le.tar.gz - # skip_tests: true - # - os-name: Linux-riscv64 - # runs-on: ubuntu-24.04 - # target: riscv64gc-unknown-linux-gnu - # bin: impit-cli - # name: impit-cli-Linux-riscv64gc-gnu.tar.gz - # - os-name: Linux-s390x - # runs-on: ubuntu-24.04 - # target: s390x-unknown-linux-gnu - # bin: impit-cli - # name: impit-cli-Linux-s390x-gnu.tar.gz - # skip_tests: true - # - os-name: NetBSD-x86_64 - # runs-on: ubuntu-24.04 - # target: x86_64-unknown-netbsd - # bin: impit-cli - # name: impit-cli-NetBSD-x86_64.tar.gz - # skip_tests: true - - os-name: Windows-aarch64 - runs-on: windows-latest - target: aarch64-pc-windows-msvc - bin: impit-cli.exe - name: impit-cli-Windows-aarch64.zip - skip_tests: true - # - os-name: Windows-i686 - # runs-on: windows-latest - # target: i686-pc-windows-msvc - # bin: impit-cli.exe - # name: impit-cli-Windows-i686.zip - # skip_tests: true - - os-name: Windows-x86_64 - runs-on: windows-latest - target: x86_64-pc-windows-msvc - bin: impit-cli.exe - name: impit-cli-Windows-x86_64.zip - - os-name: macOS-x86_64 - runs-on: macOS-latest - target: x86_64-apple-darwin - bin: impit-cli - name: impit-cli-Darwin-x86_64.tar.gz - - os-name: macOS-aarch64 - runs-on: macOS-latest - target: aarch64-apple-darwin - bin: impit-cli - name: impit-cli-Darwin-aarch64.tar.gz - toolchain: - - stable - steps: - - uses: actions/checkout@v6 - - name: Cache cargo & target directories - uses: Swatinem/rust-cache@v2 - - name: Configure Git - run: | - git config --global user.email "jdoe@example.com" - git config --global user.name "J. Doe" - - name: Build binary - uses: houseabsolute/actions-rust-cross@v0 - with: - command: "build" - target: ${{ matrix.platform.target }} - toolchain: ${{ matrix.toolchain }} - args: "--locked --release --manifest-path impit-cli/Cargo.toml" - strip: true - - - name: Run tests - uses: houseabsolute/actions-rust-cross@v0 - with: - command: "test" - target: ${{ matrix.platform.target }} - toolchain: ${{ matrix.toolchain }} - args: "--locked --release --manifest-path impit-cli/Cargo.toml" - if: ${{ !matrix.platform.skip_tests }} - - - name: Publish artifacts - uses: houseabsolute/actions-rust-release@v0.0.6 - if: matrix.toolchain == 'stable' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') - with: - executable-name: impit-cli - target: ${{ matrix.platform.target }} - changes-file: "" - release-tag-prefix: cli diff --git a/Cargo.lock b/Cargo.lock index 17ef7c57..1a14cbf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,56 +29,6 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "anstream" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" - -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys 0.61.2", -] - [[package]] name = "async-channel" version = "1.9.0" @@ -271,7 +221,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94bffc006df10ac2a68c83692d734a465f8ee6c5b384d8545a636f81d858f4bf" dependencies = [ "aws-lc-sys", - "untrusted 0.7.1", "zeroize", ] @@ -375,46 +324,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" -[[package]] -name = "clap" -version = "4.5.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" - [[package]] name = "cmake" version = "0.1.57" @@ -424,12 +333,6 @@ dependencies = [ "cc", ] -[[package]] -name = "colorchoice" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" - [[package]] name = "combine" version = "4.6.7" @@ -1346,16 +1249,6 @@ dependencies = [ "webpki-root-certs", ] -[[package]] -name = "impit-cli" -version = "0.1.0" -dependencies = [ - "aws-lc-rs", - "clap", - "impit", - "tokio", -] - [[package]] name = "impit-node" version = "0.0.0" @@ -1407,12 +1300,6 @@ version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" -[[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - [[package]] name = "itoa" version = "1.0.17" @@ -1677,12 +1564,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - [[package]] name = "openssl-probe" version = "0.2.1" @@ -2143,7 +2024,7 @@ dependencies = [ "cfg-if", "getrandom 0.2.17", "libc", - "untrusted 0.9.0", + "untrusted", "windows-sys 0.52.0", ] @@ -2250,7 +2131,7 @@ dependencies = [ "aws-lc-rs", "ring", "rustls-pki-types", - "untrusted 0.9.0", + "untrusted", ] [[package]] @@ -2438,12 +2319,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "subtle" version = "2.6.1" @@ -2752,12 +2627,6 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -2788,12 +2657,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - [[package]] name = "value-bag" version = "1.12.0" diff --git a/Cargo.toml b/Cargo.toml index 6cbd7964..16960ced 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ resolver = "2" members = [ "impit", - "impit-cli", "impit-node", "impit-python", ] diff --git a/README.md b/README.md index f4c2ce57..e6304f61 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,6 @@ async fn main() { ### Other projects -If you are looking for a command-line tool that allows you to make requests to websites, check out the [`impit-cli`](https://github.com/apify/impit/tree/master/impit-cli) project. - If you'd prefer to use `impit` from a Node.js application, check out the [`impit-node`](https://github.com/apify/impit/tree/master/impit-node) folder, or download the package from npm: ```bash diff --git a/impit-cli/Cargo.toml b/impit-cli/Cargo.toml deleted file mode 100644 index 9f0c1ea8..00000000 --- a/impit-cli/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "impit-cli" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -clap = { version = "4.5.21", features = ["derive"] } -impit = { path="../impit" } -tokio = { version="1.41.1", features = ["full"] } -aws-lc-rs = { version = "1.11.1" } - diff --git a/impit-cli/src/headers.rs b/impit-cli/src/headers.rs deleted file mode 100644 index b1b55110..00000000 --- a/impit-cli/src/headers.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub(crate) fn process_headers(headers: Vec) -> Vec<(String, String)> { - headers - .iter() - .map(|header| { - let parts: Vec<&str> = header.split(':').collect(); - if parts.len() == 2 { - let key = parts[0].trim().to_string(); - let value = parts[1].trim().to_string(); - (key, value) - } else { - ("".to_string(), "".to_string()) - } - }) - .collect() -} diff --git a/impit-cli/src/main.rs b/impit-cli/src/main.rs deleted file mode 100644 index 8e601066..00000000 --- a/impit-cli/src/main.rs +++ /dev/null @@ -1,145 +0,0 @@ -use std::ffi::OsString; - -use clap::{Parser, ValueEnum}; -use impit::{ - impit::{Impit, RedirectBehavior}, - request::RequestOptions, -}; - -mod headers; - -#[derive(Parser, Debug, Clone, Copy, ValueEnum)] -enum Browser { - Chrome, - Firefox, - Impit, -} - -#[derive(Parser, Debug, Clone, Copy, ValueEnum)] -enum Method { - Get, - Post, - Put, - Delete, - Patch, - Head, - Options, - Trace, -} - -/// CLI interface for the impit library. -/// Something like CURL for libcurl, for making impersonated HTTP(2) requests. -#[derive(Parser, Debug)] -#[command(about, long_about = None)] -struct CliArgs { - /// Method to use for the request. - #[arg(short = 'X', long, default_value = "get")] - method: Method, - - /// HTTP headers to add to the request. - #[arg(short = 'H', long)] - headers: Vec, - - /// What browser to use for the request. - #[arg(short = 'A', long, default_value = "impit")] - impersonate: Browser, - - /// If set, impit will ignore TLS errors. - #[arg(short = 'k', long, action)] - ignore_tls_errors: bool, - - /// If set, impit will fallback to vanilla HTTP if the impersonated browser fails. - #[arg(short = 'f', long, action)] - fallback: bool, - - /// Proxy to use for the request. - #[arg(short = 'x', long = "proxy")] - proxy: Option, - - /// Maximum time in seconds to wait for the request to complete. - #[arg(short = 'm', long = "max-time")] - max_time: Option, - - /// Data to send with the request. - #[arg(short, long)] - data: Option, - - /// Enforce the use of HTTP/3 for the request. Note that if the server does not support HTTP/3, the request will fail. - #[arg(long = "http3-only", action)] - http3_prior_knowledge: bool, - - /// Enable the use of HTTP/3. This will attempt to use HTTP/3, but fall back to earlier versions of HTTP if the server does not support it. - #[arg(long = "http3", action)] - enable_http3: bool, - - /// Follow redirects - #[arg(short = 'L', long = "location", action)] - follow_redirects: bool, - - /// Follow redirects - #[arg(long = "max-redirs", default_value = "50")] - maximum_redirects: usize, - - /// URL of the request to make - url: String, -} - -#[tokio::main] -async fn main() { - let args = CliArgs::parse(); - - let mut client = Impit::::builder() - .with_ignore_tls_errors(args.ignore_tls_errors) - .with_fallback_to_vanilla(args.fallback); - - client = match args.impersonate { - Browser::Chrome => { - client.with_fingerprint(impit::fingerprint::database::chrome_125::fingerprint()) - } - Browser::Firefox => { - client.with_fingerprint(impit::fingerprint::database::firefox_144::fingerprint()) - } - Browser::Impit => client, - }; - - if let Some(proxy) = args.proxy { - client = client.with_proxy(proxy) - } - - if args.enable_http3 || args.http3_prior_knowledge { - client = client.with_http3() - } - - if args.follow_redirects { - client = client.with_redirect(RedirectBehavior::FollowRedirect(args.maximum_redirects)); - } else { - client = client.with_redirect(RedirectBehavior::ManualRedirect); - } - - let body: Option> = args - .data - .map(|data| data.into_string().unwrap().into_bytes()); - - let client = client.build().unwrap(); - - let timeout = args.max_time.map(std::time::Duration::from_secs); - - let options = RequestOptions { - headers: headers::process_headers(args.headers), - http3_prior_knowledge: args.http3_prior_knowledge, - timeout, - }; - - let response = match args.method { - Method::Get => client.get(args.url, body, Some(options)).await.unwrap(), - Method::Post => client.post(args.url, body, Some(options)).await.unwrap(), - Method::Put => client.put(args.url, body, Some(options)).await.unwrap(), - Method::Delete => client.delete(args.url, body, Some(options)).await.unwrap(), - Method::Patch => client.patch(args.url, body, Some(options)).await.unwrap(), - Method::Head => client.head(args.url, body, Some(options)).await.unwrap(), - Method::Options => client.options(args.url, body, Some(options)).await.unwrap(), - Method::Trace => client.trace(args.url, body, Some(options)).await.unwrap(), - }; - - print!("{}", response.text().await.unwrap()); -} diff --git a/impit/README.md b/impit/README.md index 3221f533..f14cce22 100644 --- a/impit/README.md +++ b/impit/README.md @@ -32,8 +32,6 @@ async fn main() { ### Other projects -If you are looking for a command-line tool that allows you to make requests to websites, check out the [`impit-cli`](https://github.com/apify/impit/tree/master/impit-cli) project. - If you'd prefer to use `impit` from a Node.js application, check out the [`impit-node`](https://github.com/apify/impit/tree/master/impit-node) folder, or download the package from npm: ```bash npm install impit diff --git a/impit/src/lib.rs b/impit/src/lib.rs index 611faaf4..0af8cae7 100644 --- a/impit/src/lib.rs +++ b/impit/src/lib.rs @@ -31,8 +31,6 @@ //! //! ### Other projects //! -//! If you are looking for a command-line tool that allows you to make requests to websites, check out the [`impit-cli`](https://github.com/apify/impit/tree/master/impit-cli) project. -//! //! If you'd prefer to use `impit` from a Node.js application, check out the [`impit-node`](https://github.com/apify/impit/tree/master/impit-node) folder, or download the package from npm: //! ```bash //! npm install impit