mirror of
https://github.com/fafhrd91/actix-web
synced 2025-07-01 16:55:08 +02:00
@ -113,7 +113,7 @@ pub struct AppConfig {
|
||||
|
||||
impl AppConfig {
|
||||
pub(crate) fn new(secure: bool, addr: SocketAddr, host: String) -> Self {
|
||||
AppConfig { secure, addr, host }
|
||||
AppConfig { secure, host, addr }
|
||||
}
|
||||
|
||||
/// Server host name.
|
||||
|
12
src/lib.rs
12
src/lib.rs
@ -173,11 +173,7 @@ pub mod dev {
|
||||
|
||||
impl BodyEncoding for ResponseBuilder {
|
||||
fn get_encoding(&self) -> Option<ContentEncoding> {
|
||||
if let Some(ref enc) = self.extensions().get::<Enc>() {
|
||||
Some(enc.0)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
self.extensions().get::<Enc>().map(|enc| enc.0)
|
||||
}
|
||||
|
||||
fn encoding(&mut self, encoding: ContentEncoding) -> &mut Self {
|
||||
@ -188,11 +184,7 @@ pub mod dev {
|
||||
|
||||
impl<B> BodyEncoding for Response<B> {
|
||||
fn get_encoding(&self) -> Option<ContentEncoding> {
|
||||
if let Some(ref enc) = self.extensions().get::<Enc>() {
|
||||
Some(enc.0)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
self.extensions().get::<Enc>().map(|enc| enc.0)
|
||||
}
|
||||
|
||||
fn encoding(&mut self, encoding: ContentEncoding) -> &mut Self {
|
||||
|
@ -197,22 +197,23 @@ impl AcceptEncoding {
|
||||
|
||||
/// Parse a raw Accept-Encoding header value into an ordered list.
|
||||
pub fn parse(raw: &str, encoding: ContentEncoding) -> ContentEncoding {
|
||||
let mut encodings: Vec<_> = raw
|
||||
let mut encodings = raw
|
||||
.replace(' ', "")
|
||||
.split(',')
|
||||
.map(|l| AcceptEncoding::new(l))
|
||||
.collect();
|
||||
.flatten()
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
encodings.sort();
|
||||
|
||||
for enc in encodings {
|
||||
if let Some(enc) = enc {
|
||||
if encoding == ContentEncoding::Auto {
|
||||
return enc.encoding;
|
||||
} else if encoding == enc.encoding {
|
||||
return encoding;
|
||||
}
|
||||
if encoding == ContentEncoding::Auto {
|
||||
return enc.encoding;
|
||||
} else if encoding == enc.encoding {
|
||||
return encoding;
|
||||
}
|
||||
}
|
||||
|
||||
ContentEncoding::Identity
|
||||
}
|
||||
}
|
||||
|
@ -449,9 +449,9 @@ impl ServiceFactory<ServiceRequest> for ResourceFactory {
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(ResourceService {
|
||||
routes,
|
||||
app_data,
|
||||
default,
|
||||
routes,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -774,10 +774,10 @@ where
|
||||
};
|
||||
|
||||
TestServer {
|
||||
ssl,
|
||||
addr,
|
||||
client,
|
||||
system,
|
||||
ssl,
|
||||
server,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user