mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Accept charset=*
in Content-Type
for masterserver
You should generally not send a `charset=*` parameter for `Content-Type: application/json` because no parameters are defined for it: https://datatracker.ietf.org/doc/html/rfc7158#section-11. Fixes #6955.
This commit is contained in:
parent
349eb38ebf
commit
1d638707b2
1
src/mastersrv/Cargo.lock
generated
1
src/mastersrv/Cargo.lock
generated
|
@ -443,6 +443,7 @@ dependencies = [
|
|||
"hex",
|
||||
"ipnet",
|
||||
"log",
|
||||
"mime",
|
||||
"rand",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -22,6 +22,7 @@ headers = "0.3.7"
|
|||
hex = "0.4.3"
|
||||
ipnet = { version = "2.5.0", features = ["serde"] }
|
||||
log = "0.4.17"
|
||||
mime = "0.3.16"
|
||||
rand = "0.8.4"
|
||||
serde = { version = "1.0.126", features = ["derive"] }
|
||||
serde_json = { version = "1.0.64", features = [
|
||||
|
|
|
@ -823,8 +823,9 @@ fn register_from_headers(
|
|||
challenge_token: parse_opt(headers, "Challenge-Token")?,
|
||||
info_serial: parse(headers, "Info-Serial")?,
|
||||
info: if !info.is_empty() {
|
||||
if headers.typed_get() != Some(headers::ContentType::json()) {
|
||||
return Err(RegisterError::unsupported_media_type());
|
||||
match headers.typed_get::<headers::ContentType>().map(mime::Mime::from) {
|
||||
Some(mime) if mime.essence_str() == mime::APPLICATION_JSON => {}
|
||||
_ => return Err(RegisterError::unsupported_media_type()),
|
||||
}
|
||||
Some(json::from_slice(info).map_err(|e| {
|
||||
RegisterError::new(format!("Request body deserialize error: {}", e))
|
||||
|
|
Loading…
Reference in a new issue