mirror of
https://github.com/fafhrd91/actix-web
synced 2025-05-18 23:15:19 +02:00
fix: improve logger header values printing
This commit is contained in:
parent
89b5b04653
commit
55268b6898
@ -4,5 +4,6 @@ words:
|
||||
- addrs
|
||||
- httparse
|
||||
- msrv
|
||||
- realip
|
||||
- rustup
|
||||
- zstd
|
||||
|
@ -3,6 +3,7 @@
|
||||
## Unreleased
|
||||
|
||||
- Add `Logger::log_level()` method.
|
||||
- Improve handling of non-UTF-8 header values in `Logger` middleware.
|
||||
- Add `HttpServer::shutdown_signal()` method.
|
||||
- Mark `HttpServer` as `#[must_use]`.
|
||||
- Re-export `mime` dependency.
|
||||
|
@ -649,9 +649,9 @@ impl FormatText {
|
||||
|
||||
FormatText::ResponseHeader(ref name) => {
|
||||
let s = if let Some(val) = res.headers().get(name) {
|
||||
val.to_str().unwrap_or("-")
|
||||
String::from_utf8_lossy(val.as_bytes()).into_owned()
|
||||
} else {
|
||||
"-"
|
||||
"-".to_owned()
|
||||
};
|
||||
*self = FormatText::Str(s.to_string())
|
||||
}
|
||||
@ -693,11 +693,11 @@ impl FormatText {
|
||||
FormatText::RequestTime => *self = FormatText::Str(now.format(&Rfc3339).unwrap()),
|
||||
FormatText::RequestHeader(ref name) => {
|
||||
let s = if let Some(val) = req.headers().get(name) {
|
||||
val.to_str().unwrap_or("-")
|
||||
String::from_utf8_lossy(val.as_bytes()).into_owned()
|
||||
} else {
|
||||
"-"
|
||||
"-".to_owned()
|
||||
};
|
||||
*self = FormatText::Str(s.to_string());
|
||||
*self = FormatText::Str(s);
|
||||
}
|
||||
FormatText::RemoteAddr => {
|
||||
let s = if let Some(peer) = req.connection_info().peer_addr() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user