use pub(crate) instead of include!()
This commit is contained in:
25
src/agent.rs
25
src/agent.rs
@@ -1,14 +1,11 @@
|
|||||||
use crate::error::Error;
|
use std::sync::Arc;
|
||||||
use crate::pool::ConnectionPool;
|
|
||||||
use crate::response::{self, Response};
|
|
||||||
use cookie::{Cookie, CookieJar};
|
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
|
|
||||||
use crate::header::{add_header, get_all_headers, get_header, has_header, Header};
|
use cookie::{Cookie, CookieJar};
|
||||||
|
|
||||||
// to get to share private fields
|
use crate::header::{self, Header};
|
||||||
include!("request.rs");
|
use crate::pool::ConnectionPool;
|
||||||
include!("unit.rs");
|
use crate::request::Request;
|
||||||
|
|
||||||
/// Agents keep state between requests.
|
/// Agents keep state between requests.
|
||||||
///
|
///
|
||||||
@@ -41,9 +38,9 @@ include!("unit.rs");
|
|||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct Agent {
|
pub struct Agent {
|
||||||
/// Copied into each request of this agent.
|
/// Copied into each request of this agent.
|
||||||
headers: Vec<Header>,
|
pub(crate) headers: Vec<Header>,
|
||||||
/// Reused agent state for repeated requests from this agent.
|
/// Reused agent state for repeated requests from this agent.
|
||||||
state: Arc<Mutex<Option<AgentState>>>,
|
pub(crate) state: Arc<Mutex<Option<AgentState>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Container of the state
|
/// Container of the state
|
||||||
@@ -52,9 +49,9 @@ pub struct Agent {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct AgentState {
|
pub(crate) struct AgentState {
|
||||||
/// Reused connections between requests.
|
/// Reused connections between requests.
|
||||||
pool: ConnectionPool,
|
pub(crate) pool: ConnectionPool,
|
||||||
/// Cookies saved between requests.
|
/// Cookies saved between requests.
|
||||||
jar: CookieJar,
|
pub(crate) jar: CookieJar,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AgentState {
|
impl AgentState {
|
||||||
@@ -113,7 +110,7 @@ impl Agent {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn set(&mut self, header: &str, value: &str) -> &mut Agent {
|
pub fn set(&mut self, header: &str, value: &str) -> &mut Agent {
|
||||||
add_header(&mut self.headers, Header::new(header, value));
|
header::add_header(&mut self.headers, Header::new(header, value));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +252,7 @@ impl Agent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn basic_auth(user: &str, pass: &str) -> String {
|
pub(crate) fn basic_auth(user: &str, pass: &str) -> String {
|
||||||
let safe = match user.find(':') {
|
let safe = match user.find(':') {
|
||||||
Some(idx) => &user[..idx],
|
Some(idx) => &user[..idx],
|
||||||
None => user,
|
None => user,
|
||||||
|
|||||||
@@ -97,8 +97,10 @@ mod body;
|
|||||||
mod error;
|
mod error;
|
||||||
mod header;
|
mod header;
|
||||||
mod pool;
|
mod pool;
|
||||||
|
mod request;
|
||||||
mod response;
|
mod response;
|
||||||
mod stream;
|
mod stream;
|
||||||
|
mod unit;
|
||||||
|
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
mod serde_macros;
|
mod serde_macros;
|
||||||
@@ -106,9 +108,10 @@ mod serde_macros;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test;
|
mod test;
|
||||||
|
|
||||||
pub use crate::agent::{Agent, Request};
|
pub use crate::agent::Agent;
|
||||||
pub use crate::error::Error;
|
pub use crate::error::Error;
|
||||||
pub use crate::header::Header;
|
pub use crate::header::Header;
|
||||||
|
pub use crate::request::Request;
|
||||||
pub use crate::response::Response;
|
pub use crate::response::Response;
|
||||||
|
|
||||||
// re-export
|
// re-export
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
use crate::agent::Unit;
|
|
||||||
use crate::stream::Stream;
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::{Read, Result as IoResult};
|
use std::io::{Read, Result as IoResult};
|
||||||
|
|
||||||
|
use crate::stream::Stream;
|
||||||
|
use crate::unit::Unit;
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
pub const DEFAULT_HOST: &str = "localhost";
|
pub const DEFAULT_HOST: &str = "localhost";
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
|
use std::io::Read;
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use qstring::QString;
|
use qstring::QString;
|
||||||
use std::io::Read;
|
use url::Url;
|
||||||
use std::sync::Arc;
|
|
||||||
|
use crate::agent::{self, Agent, AgentState};
|
||||||
|
use crate::body::Payload;
|
||||||
|
use crate::error::Error;
|
||||||
|
use crate::header::{self, Header};
|
||||||
|
use crate::pool;
|
||||||
|
use crate::unit::{self, Unit};
|
||||||
|
use crate::Response;
|
||||||
|
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
use super::SerdeValue;
|
use super::SerdeValue;
|
||||||
@@ -22,19 +32,19 @@ lazy_static! {
|
|||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
agent: Arc<Mutex<Option<AgentState>>>,
|
pub(crate) agent: Arc<Mutex<Option<AgentState>>>,
|
||||||
|
|
||||||
// via agent
|
// via agent
|
||||||
method: String,
|
pub(crate) method: String,
|
||||||
path: String,
|
path: String,
|
||||||
|
|
||||||
// from request itself
|
// from request itself
|
||||||
headers: Vec<Header>,
|
pub(crate) headers: Vec<Header>,
|
||||||
query: QString,
|
pub(crate) query: QString,
|
||||||
timeout_connect: u64,
|
pub(crate) timeout_connect: u64,
|
||||||
timeout_read: u64,
|
pub(crate) timeout_read: u64,
|
||||||
timeout_write: u64,
|
pub(crate) timeout_write: u64,
|
||||||
redirects: u32,
|
pub(crate) redirects: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::std::fmt::Debug for Request {
|
impl ::std::fmt::Debug for Request {
|
||||||
@@ -42,7 +52,7 @@ impl ::std::fmt::Debug for Request {
|
|||||||
let (path, query) = self
|
let (path, query) = self
|
||||||
.to_url()
|
.to_url()
|
||||||
.map(|u| {
|
.map(|u| {
|
||||||
let query = combine_query(&u, &self.query, true);
|
let query = unit::combine_query(&u, &self.query, true);
|
||||||
(u.path().to_string(), query)
|
(u.path().to_string(), query)
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|_| ("BAD_URL".to_string(), "BAD_URL".to_string()));
|
.unwrap_or_else(|_| ("BAD_URL".to_string(), "BAD_URL".to_string()));
|
||||||
@@ -55,7 +65,7 @@ impl ::std::fmt::Debug for Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
fn new(agent: &Agent, method: String, path: String) -> Request {
|
pub(crate) fn new(agent: &Agent, method: String, path: String) -> Request {
|
||||||
Request {
|
Request {
|
||||||
agent: Arc::clone(&agent.state),
|
agent: Arc::clone(&agent.state),
|
||||||
method,
|
method,
|
||||||
@@ -99,7 +109,7 @@ impl Request {
|
|||||||
.and_then(|url| {
|
.and_then(|url| {
|
||||||
let reader = payload.into_read();
|
let reader = payload.into_read();
|
||||||
let unit = Unit::new(&self, &url, true, &reader);
|
let unit = Unit::new(&self, &url, true, &reader);
|
||||||
connect(&self, unit, true, 0, reader, false)
|
unit::connect(&self, unit, true, 0, reader, false)
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|e| e.into())
|
.unwrap_or_else(|e| e.into())
|
||||||
}
|
}
|
||||||
@@ -148,7 +158,8 @@ impl Request {
|
|||||||
/// ```
|
/// ```
|
||||||
pub fn send_string(&mut self, data: &str) -> Response {
|
pub fn send_string(&mut self, data: &str) -> Response {
|
||||||
let text = data.into();
|
let text = data.into();
|
||||||
let charset = response::charset_from_content_type(self.header("content-type")).to_string();
|
let charset =
|
||||||
|
crate::response::charset_from_content_type(self.header("content-type")).to_string();
|
||||||
self.do_call(Payload::Text(text, charset))
|
self.do_call(Payload::Text(text, charset))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +196,7 @@ impl Request {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
pub fn set(&mut self, header: &str, value: &str) -> &mut Request {
|
pub fn set(&mut self, header: &str, value: &str) -> &mut Request {
|
||||||
add_header(&mut self.headers, Header::new(header, value));
|
header::add_header(&mut self.headers, Header::new(header, value));
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +209,7 @@ impl Request {
|
|||||||
/// assert_eq!("foobar", req.header("x-api-Key").unwrap());
|
/// assert_eq!("foobar", req.header("x-api-Key").unwrap());
|
||||||
/// ```
|
/// ```
|
||||||
pub fn header<'a>(&self, name: &'a str) -> Option<&str> {
|
pub fn header<'a>(&self, name: &'a str) -> Option<&str> {
|
||||||
get_header(&self.headers, name)
|
header::get_header(&self.headers, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A list of the set header names in this request. Lowercased to be uniform.
|
/// A list of the set header names in this request. Lowercased to be uniform.
|
||||||
@@ -226,7 +237,7 @@ impl Request {
|
|||||||
/// assert_eq!(true, req.has("x-api-Key"));
|
/// assert_eq!(true, req.has("x-api-Key"));
|
||||||
/// ```
|
/// ```
|
||||||
pub fn has<'a>(&self, name: &'a str) -> bool {
|
pub fn has<'a>(&self, name: &'a str) -> bool {
|
||||||
has_header(&self.headers, name)
|
header::has_header(&self.headers, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// All headers corresponding values for the give name, or empty vector.
|
/// All headers corresponding values for the give name, or empty vector.
|
||||||
@@ -242,7 +253,7 @@ impl Request {
|
|||||||
/// ]);
|
/// ]);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn all<'a>(&self, name: &'a str) -> Vec<&str> {
|
pub fn all<'a>(&self, name: &'a str) -> Vec<&str> {
|
||||||
get_all_headers(&self.headers, name)
|
header::get_all_headers(&self.headers, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a query parameter.
|
/// Set a query parameter.
|
||||||
@@ -336,7 +347,7 @@ impl Request {
|
|||||||
/// println!("{:?}", r2);
|
/// println!("{:?}", r2);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn auth(&mut self, user: &str, pass: &str) -> &mut Request {
|
pub fn auth(&mut self, user: &str, pass: &str) -> &mut Request {
|
||||||
let pass = basic_auth(user, pass);
|
let pass = agent::basic_auth(user, pass);
|
||||||
self.auth_kind("Basic", &pass)
|
self.auth_kind("Basic", &pass)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +451,7 @@ impl Request {
|
|||||||
/// ```
|
/// ```
|
||||||
pub fn get_host(&self) -> Result<String, Error> {
|
pub fn get_host(&self) -> Result<String, Error> {
|
||||||
self.to_url()
|
self.to_url()
|
||||||
.map(|u| u.host_str().unwrap_or(DEFAULT_HOST).to_string())
|
.map(|u| u.host_str().unwrap_or(pool::DEFAULT_HOST).to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the scheme for this request.
|
/// Returns the scheme for this request.
|
||||||
@@ -465,7 +476,8 @@ impl Request {
|
|||||||
/// assert_eq!(req.get_query().unwrap(), "?foo=bar&format=json");
|
/// assert_eq!(req.get_query().unwrap(), "?foo=bar&format=json");
|
||||||
/// ```
|
/// ```
|
||||||
pub fn get_query(&self) -> Result<String, Error> {
|
pub fn get_query(&self) -> Result<String, Error> {
|
||||||
self.to_url().map(|u| combine_query(&u, &self.query, true))
|
self.to_url()
|
||||||
|
.map(|u| unit::combine_query(&u, &self.query, true))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The normalized path of this request.
|
/// The normalized path of this request.
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
use crate::agent::Unit;
|
use std::io::{Cursor, Error as IoError, ErrorKind, Read, Result as IoResult};
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use ascii::AsciiString;
|
||||||
|
use chunked_transfer::Decoder as ChunkDecoder;
|
||||||
|
|
||||||
|
use crate::error::Error;
|
||||||
use crate::header::Header;
|
use crate::header::Header;
|
||||||
use crate::pool::PoolReturnRead;
|
use crate::pool::PoolReturnRead;
|
||||||
use crate::stream::Stream;
|
use crate::stream::Stream;
|
||||||
use ascii::AsciiString;
|
use crate::unit::Unit;
|
||||||
use chunked_transfer::Decoder as ChunkDecoder;
|
|
||||||
use std::io::{Cursor, Error as IoError, ErrorKind, Read, Result as IoResult};
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
#[cfg(feature = "json")]
|
#[cfg(feature = "json")]
|
||||||
use serde_json;
|
use serde_json;
|
||||||
@@ -15,8 +18,6 @@ use encoding::label::encoding_from_whatwg_label;
|
|||||||
#[cfg(feature = "charset")]
|
#[cfg(feature = "charset")]
|
||||||
use encoding::DecoderTrap;
|
use encoding::DecoderTrap;
|
||||||
|
|
||||||
use crate::error::Error;
|
|
||||||
|
|
||||||
pub const DEFAULT_CONTENT_TYPE: &str = "text/plain";
|
pub const DEFAULT_CONTENT_TYPE: &str = "text/plain";
|
||||||
pub const DEFAULT_CHARACTER_SET: &str = "utf-8";
|
pub const DEFAULT_CHARACTER_SET: &str = "utf-8";
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
use crate::agent::Unit;
|
|
||||||
use crate::error::Error;
|
|
||||||
use std::io::{Cursor, Read, Result as IoResult, Write};
|
use std::io::{Cursor, Read, Result as IoResult, Write};
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use std::net::ToSocketAddrs;
|
use std::net::ToSocketAddrs;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use crate::error::Error;
|
||||||
|
use crate::unit::Unit;
|
||||||
|
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum Stream {
|
pub enum Stream {
|
||||||
Http(TcpStream),
|
Http(TcpStream),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::agent::Unit;
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
use crate::stream::Stream;
|
use crate::stream::Stream;
|
||||||
|
use crate::unit::Unit;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::io::{Cursor, Write};
|
use std::io::{Cursor, Write};
|
||||||
|
|||||||
37
src/unit.rs
37
src/unit.rs
@@ -1,9 +1,16 @@
|
|||||||
use crate::body::{send_body, Payload, SizedReader};
|
|
||||||
use crate::stream::{connect_http, connect_https, connect_test, Stream};
|
|
||||||
use base64;
|
|
||||||
use std::io::{Result as IoResult, Write};
|
use std::io::{Result as IoResult, Write};
|
||||||
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use base64;
|
||||||
|
use cookie::{Cookie, CookieJar};
|
||||||
|
use qstring::QString;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
//
|
|
||||||
|
use crate::agent::AgentState;
|
||||||
|
use crate::body::{self, Payload, SizedReader};
|
||||||
|
use crate::header;
|
||||||
|
use crate::stream::{self, connect_https, connect_test, Stream};
|
||||||
|
use crate::{Error, Header, Request, Response};
|
||||||
|
|
||||||
use crate::pool::DEFAULT_HOST;
|
use crate::pool::DEFAULT_HOST;
|
||||||
|
|
||||||
@@ -26,7 +33,7 @@ pub(crate) struct Unit {
|
|||||||
impl Unit {
|
impl Unit {
|
||||||
//
|
//
|
||||||
|
|
||||||
fn new(req: &Request, url: &Url, mix_queries: bool, body: &SizedReader) -> Self {
|
pub(crate) fn new(req: &Request, url: &Url, mix_queries: bool, body: &SizedReader) -> Self {
|
||||||
//
|
//
|
||||||
|
|
||||||
let is_chunked = req
|
let is_chunked = req
|
||||||
@@ -96,15 +103,15 @@ impl Unit {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub fn header<'a>(&self, name: &'a str) -> Option<&str> {
|
pub fn header<'a>(&self, name: &'a str) -> Option<&str> {
|
||||||
get_header(&self.headers, name)
|
header::get_header(&self.headers, name)
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub fn has<'a>(&self, name: &'a str) -> bool {
|
pub fn has<'a>(&self, name: &'a str) -> bool {
|
||||||
has_header(&self.headers, name)
|
header::has_header(&self.headers, name)
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub fn all<'a>(&self, name: &'a str) -> Vec<&str> {
|
pub fn all<'a>(&self, name: &'a str) -> Vec<&str> {
|
||||||
get_all_headers(&self.headers, name)
|
header::get_all_headers(&self.headers, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,7 +143,7 @@ pub(crate) fn connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send the body (which can be empty now depending on redirects)
|
// send the body (which can be empty now depending on redirects)
|
||||||
send_body(body, unit.is_chunked, &mut stream)?;
|
body::send_body(body, unit.is_chunked, &mut stream)?;
|
||||||
|
|
||||||
// start reading the response to process cookies and redirects.
|
// start reading the response to process cookies and redirects.
|
||||||
let mut resp = Response::from_read(&mut stream);
|
let mut resp = Response::from_read(&mut stream);
|
||||||
@@ -182,7 +189,7 @@ pub(crate) fn connect(
|
|||||||
|
|
||||||
// since it is not a redirect, or we're not following redirects,
|
// since it is not a redirect, or we're not following redirects,
|
||||||
// give away the incoming stream to the response object
|
// give away the incoming stream to the response object
|
||||||
response::set_stream(&mut resp, unit.url.to_string(), Some(unit), stream);
|
crate::response::set_stream(&mut resp, unit.url.to_string(), Some(unit), stream);
|
||||||
|
|
||||||
// release the response
|
// release the response
|
||||||
Ok(resp)
|
Ok(resp)
|
||||||
@@ -219,7 +226,7 @@ fn match_cookies<'a>(jar: &'a CookieJar, domain: &str, path: &str, is_secure: bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Combine the query of the url and the query options set on the request object.
|
/// Combine the query of the url and the query options set on the request object.
|
||||||
fn combine_query(url: &Url, query: &QString, mix_queries: bool) -> String {
|
pub(crate) fn combine_query(url: &Url, query: &QString, mix_queries: bool) -> String {
|
||||||
match (url.query(), !query.is_empty() && mix_queries) {
|
match (url.query(), !query.is_empty() && mix_queries) {
|
||||||
(Some(urlq), true) => format!("?{}&{}", urlq, query),
|
(Some(urlq), true) => format!("?{}&{}", urlq, query),
|
||||||
(Some(urlq), false) => format!("?{}", urlq),
|
(Some(urlq), false) => format!("?{}", urlq),
|
||||||
@@ -239,7 +246,7 @@ fn connect_socket(unit: &Unit, use_pooled: bool) -> Result<(Stream, bool), Error
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let stream = match unit.url.scheme() {
|
let stream = match unit.url.scheme() {
|
||||||
"http" => connect_http(&unit),
|
"http" => stream::connect_http(&unit),
|
||||||
"https" => connect_https(&unit),
|
"https" => connect_https(&unit),
|
||||||
"test" => connect_test(&unit),
|
"test" => connect_test(&unit),
|
||||||
_ => Err(Error::UnknownScheme(unit.url.scheme().to_string())),
|
_ => Err(Error::UnknownScheme(unit.url.scheme().to_string())),
|
||||||
@@ -264,13 +271,13 @@ fn send_prelude(unit: &Unit, stream: &mut Stream, redir: bool) -> IoResult<()> {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
// host header if not set by user.
|
// host header if not set by user.
|
||||||
if !has_header(&unit.headers, "host") {
|
if !header::has_header(&unit.headers, "host") {
|
||||||
write!(prelude, "Host: {}\r\n", unit.url.host().unwrap())?;
|
write!(prelude, "Host: {}\r\n", unit.url.host().unwrap())?;
|
||||||
}
|
}
|
||||||
if !has_header(&unit.headers, "user-agent") {
|
if !header::has_header(&unit.headers, "user-agent") {
|
||||||
write!(prelude, "User-Agent: ureq\r\n")?;
|
write!(prelude, "User-Agent: ureq\r\n")?;
|
||||||
}
|
}
|
||||||
if !has_header(&unit.headers, "accept") {
|
if !header::has_header(&unit.headers, "accept") {
|
||||||
write!(prelude, "Accept: */*\r\n")?;
|
write!(prelude, "Accept: */*\r\n")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user