Skip to content

Commit 0dcbed4

Browse files
authored
fmtp: add Unicode case-folding support for parameter compariso (#721)
Signed-off-by: Xiaobo Liu <[email protected]>
1 parent 813b905 commit 0dcbed4

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webrtc/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ waitgroup = "0.1"
5050
regex = "1.9.5"
5151
smol_str = { version = "0.2", features = ["serde"] }
5252
url = "2"
53-
rustls = { version = "0.23.27", default-features = false, features = ["std", "ring"] }
53+
rustls = { version = "0.23.27", default-features = false, features = [
54+
"std",
55+
"ring",
56+
] }
5457
rcgen = { version = "0.13", features = ["pem", "x509-parser"] }
5558
ring = "0.17.14"
5659
sha2 = "0.10"
@@ -60,6 +63,7 @@ pem = { version = "3", optional = true }
6063
time = "0.3"
6164
cfg-if = "1"
6265
portable-atomic = "1.6"
66+
unicase = "2.8"
6367

6468
[dev-dependencies]
6569
tokio-test = "0.4"

webrtc/src/rtp_transceiver/fmtp/generic/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#[cfg(test)]
22
mod generic_test;
33

4+
use unicase::UniCase;
5+
46
use super::*;
57

68
/// fmtp_consist checks that two FMTP parameters are not inconsistent.
79
fn fmtp_consist(a: &HashMap<String, String>, b: &HashMap<String, String>) -> bool {
8-
//TODO: add unicode case-folding equal support
910
for (k, v) in a {
1011
if let Some(vb) = b.get(k) {
11-
if vb.to_uppercase() != v.to_uppercase() {
12+
if UniCase::new(v) != UniCase::new(vb) {
1213
return false;
1314
}
1415
}
1516
}
1617
for (k, v) in b {
1718
if let Some(va) = a.get(k) {
18-
if va.to_uppercase() != v.to_uppercase() {
19+
if UniCase::new(v) != UniCase::new(va) {
1920
return false;
2021
}
2122
}

0 commit comments

Comments
 (0)