1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-30 12:00:38 +00:00
This commit is contained in:
Rob Ede 2021-04-13 12:44:38 +01:00
parent edd9f14752
commit 4442535a45
No known key found for this signature in database
GPG key ID: 97C636207D3EF933
3 changed files with 8 additions and 6 deletions

View file

@ -1213,8 +1213,9 @@ mod tests {
#[test] #[test]
fn test_parse_chunked_payload_chunk_extension() { fn test_parse_chunked_payload_chunk_extension() {
let mut buf = BytesMut::from( let mut buf = BytesMut::from(
&"GET /test HTTP/1.1\r\n\ "GET /test HTTP/1.1\r\n\
transfer-encoding: chunked\r\n\r\n"[..], transfer-encoding: chunked\r\n\
\r\n",
); );
let mut reader = MessageDecoder::<Request>::default(); let mut reader = MessageDecoder::<Request>::default();
@ -1233,7 +1234,7 @@ mod tests {
#[test] #[test]
fn test_response_http10_read_until_eof() { fn test_response_http10_read_until_eof() {
let mut buf = BytesMut::from(&"HTTP/1.0 200 Ok\r\n\r\ntest data"[..]); let mut buf = BytesMut::from("HTTP/1.0 200 Ok\r\n\r\ntest data");
let mut reader = MessageDecoder::<ResponseHead>::default(); let mut reader = MessageDecoder::<ResponseHead>::default();
let (_msg, pl) = reader.decode(&mut buf).unwrap().unwrap(); let (_msg, pl) = reader.decode(&mut buf).unwrap().unwrap();

View file

@ -70,6 +70,7 @@ macro_rules! downcast {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
#![allow(clippy::upper_case_acronyms)]
trait MB { trait MB {
downcast_get_type_id!(); downcast_get_type_id!();

View file

@ -380,7 +380,7 @@ impl Format {
results.push(match cap.get(3).unwrap().as_str() { results.push(match cap.get(3).unwrap().as_str() {
"a" => { "a" => {
if key.as_str() == "r" { if key.as_str() == "r" {
FormatText::RealIPRemoteAddr FormatText::RealIpRemoteAddr
} else { } else {
unreachable!() unreachable!()
} }
@ -434,7 +434,7 @@ enum FormatText {
Time, Time,
TimeMillis, TimeMillis,
RemoteAddr, RemoteAddr,
RealIPRemoteAddr, RealIpRemoteAddr,
UrlPath, UrlPath,
RequestHeader(HeaderName), RequestHeader(HeaderName),
ResponseHeader(HeaderName), ResponseHeader(HeaderName),
@ -554,7 +554,7 @@ impl FormatText {
}; };
*self = s; *self = s;
} }
FormatText::RealIPRemoteAddr => { FormatText::RealIpRemoteAddr => {
let s = if let Some(remote) = req.connection_info().realip_remote_addr() { let s = if let Some(remote) = req.connection_info().realip_remote_addr() {
FormatText::Str(remote.to_string()) FormatText::Str(remote.to_string())
} else { } else {