mirror of
https://git.asonix.dog/asonix/relay.git
synced 2025-11-28 11:40:34 +00:00
Fix accept header checking on webfinger
This commit is contained in:
parent
917f0baed4
commit
4e25432946
|
|
@ -72,12 +72,14 @@ impl WebfingerResource {
|
||||||
return Err(ErrorKind::MissingAccept);
|
return Err(ErrorKind::MissingAccept);
|
||||||
};
|
};
|
||||||
|
|
||||||
let accept = accept.to_str().map_err(|_| ErrorKind::InvalidAccept)?;
|
let accept_value = accept.to_str().map_err(|_| ErrorKind::InvalidAccept)?;
|
||||||
let accept = accept
|
|
||||||
.parse::<mime::Mime>()
|
|
||||||
.map_err(|_| ErrorKind::InvalidAccept)?;
|
|
||||||
|
|
||||||
if !is_supported_json(&accept) {
|
let acceptable = accept_value
|
||||||
|
.split(", ")
|
||||||
|
.filter_map(|accept| accept.trim().parse::<mime::Mime>().ok())
|
||||||
|
.any(|accept| is_supported_json(&accept));
|
||||||
|
|
||||||
|
if !acceptable {
|
||||||
return Err(ErrorKind::InvalidAccept);
|
return Err(ErrorKind::InvalidAccept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user