1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Body-aware classification for proxy health feedback.
/// Result of classifying a response body from a proxy.
/// Classify responses with full body to determine proxy health at business level.
///
/// # Example
/// ```rust,no_run
/// use reqwest_proxy_pool::{BodyClassifier, ProxyBodyVerdict};
///
/// struct CaptchaDetector;
///
/// impl BodyClassifier for CaptchaDetector {
/// fn classify(
/// &self,
/// status: reqwest::StatusCode,
/// _headers: &reqwest::header::HeaderMap,
/// body: &[u8],
/// ) -> ProxyBodyVerdict {
/// if status == reqwest::StatusCode::TOO_MANY_REQUESTS
/// || String::from_utf8_lossy(body).contains("captcha")
/// {
/// ProxyBodyVerdict::ProxyBlocked
/// } else if status.is_success() {
/// ProxyBodyVerdict::Success
/// } else {
/// ProxyBodyVerdict::Passthrough
/// }
/// }
/// }
/// ```
/// Default classifier: HTTP success = Success, otherwise Passthrough.
;