4JX / reqwest-impersonate

Impersonating the Chrome browser made easy
https://docs.rs/reqwest
Apache License 2.0
38 stars 6 forks source link

proc macros failed to build (boring-sys) #5

Open Stefanuk12 opened 11 months ago

Stefanuk12 commented 11 months ago
thread 'main' panicked at '"enum_(unnamed_at_deps/boringssl/src/include/openssl/err_h_291_1)" is not a valid Ident

System

Dependencies

[dependencies]
reqwest-impersonate = { git = "https://github.com/4JX/reqwest-impersonate.git", default-features = false, features = [
    "chrome",
    "blocking",
] }

[patch.crates-io]
hyper = { git = "https://github.com/4JX/hyper.git", branch = "v0.14.18-patched" }
h2 = { git = "https://github.com/4JX/h2.git", branch = "imp" }

main.rs

use reqwest_impersonate::browser::ChromeVersion;

fn main() {
    // Build a client to mimic Chrome 104
    let client = reqwest_impersonate::blocking::Client::builder()
        .chrome_builder(ChromeVersion::V104)
        .build()
        .unwrap();

    // Use the API you're already familiar with
    match client.get("https://yoururl.com").send() {
        Ok(res) => {
            println!("{:?}", res.text().unwrap());
        }
        Err(err) => {
            dbg!(err);
        }
    };
}
Stefanuk12 commented 11 months ago

The issue can be found here https://github.com/cloudflare/boring/issues/121, possibly update the boring crate?

DokkanWiki commented 2 months ago

Manually bumping bindgen on boring-sys to at least version 0.62.0 (https://github.com/4JX/boring/blob/2a7463aac6f09b79628b764b2323ddb0dd5ca2c3/boring-sys/Cargo.toml#L30) and updating build.rs (https://github.com/4JX/boring/blob/2a7463aac6f09b79628b764b2323ddb0dd5ca2c3/boring-sys/build.rs#L387) :

.default_enum_style(bindgen::EnumVariation::NewType { is_bitfield: false, is_global: false })

Allow it to compile.