diff --git a/is-html-fast/src/main.rs b/is-html-fast/src/main.rs index 1d014d3..78822d9 100644 --- a/is-html-fast/src/main.rs +++ b/is-html-fast/src/main.rs @@ -6,7 +6,7 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use rayon::prelude::*; use reqwest::blocking::Client; -use reqwest::header::{CONTENT_TYPE, USER_AGENT}; +use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE, USER_AGENT, ACCEPT, ACCEPT_LANGUAGE, ACCEPT_ENCODING, CONNECTION, UPGRADE_INSECURE_REQUESTS}; fn main() -> Result<(), Box> { let input_file = File::open("domains.txt")?; @@ -27,10 +27,19 @@ fn main() -> Result<(), Box> { let output = Arc::new(Mutex::new(output_file)); + // 브라우저 헤더 세팅 + let mut headers = HeaderMap::new(); + headers.insert(USER_AGENT, HeaderValue::from_static("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0")); + headers.insert(ACCEPT, HeaderValue::from_static("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")); + headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_static("ko,en-US;q=0.7,en;q=0.3")); + headers.insert(ACCEPT_ENCODING, HeaderValue::from_static("gzip, deflate, br")); + headers.insert(CONNECTION, HeaderValue::from_static("keep-alive")); + headers.insert(UPGRADE_INSECURE_REQUESTS, HeaderValue::from_static("1")); + let client = Arc::new( Client::builder() .timeout(Duration::from_secs(5)) - .user_agent("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0") + .default_headers(headers) .build()?, );