use crate::http::header_processor::HttpResponseHead;
#[derive(Debug, Clone)]
pub enum ProxyResponse {
Connected(HttpResponseHead),
AuthRequired {
response: HttpResponseHead,
},
Error {
status_code: u16,
reason: String,
},
}
impl ProxyResponse {
pub(crate) fn from_head(head: HttpResponseHead) -> Self {
match head.status_code {
200 => ProxyResponse::Connected(head),
407 => ProxyResponse::AuthRequired { response: head },
code => ProxyResponse::Error {
status_code: code,
reason: head.reason_phrase.clone(),
},
}
}
}