geforkt von mirrored/vaultwarden
When receiving a comma separated list as IP, pick the first
Dieser Commit ist enthalten in:
Ursprung
5c6081c4e2
Commit
cb6f392774
1 geänderte Dateien mit 7 neuen und 3 gelöschten Zeilen
10
src/auth.rs
10
src/auth.rs
|
@ -429,9 +429,13 @@ impl<'a, 'r> FromRequest<'a, 'r> for ClientIp {
|
||||||
fn from_request(req: &'a Request<'r>) -> request::Outcome<Self, Self::Error> {
|
fn from_request(req: &'a Request<'r>) -> request::Outcome<Self, Self::Error> {
|
||||||
let ip = if CONFIG._ip_header_enabled() {
|
let ip = if CONFIG._ip_header_enabled() {
|
||||||
req.headers().get_one(&CONFIG.ip_header()).and_then(|ip| {
|
req.headers().get_one(&CONFIG.ip_header()).and_then(|ip| {
|
||||||
ip.parse()
|
match ip.find(',') {
|
||||||
.map_err(|_| warn_!("'{}' header is malformed: {}", CONFIG.ip_header(), ip))
|
Some(idx) => &ip[..idx],
|
||||||
.ok()
|
None => ip,
|
||||||
|
}
|
||||||
|
.parse()
|
||||||
|
.map_err(|_| warn!("'{}' header is malformed: {}", CONFIG.ip_header(), ip))
|
||||||
|
.ok()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
Laden …
In neuem Issue referenzieren