diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ba1742248ffe71a3ce5d45053f47159030da4b50..3f233d21b15fa678e2dae3df182edba04d670be8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -18,12 +18,12 @@ rust-nightly:
- cargo build --verbose --no-default-features --features=$FEATURES
- cargo test --verbose --no-default-features --features=$FEATURES
-"rust-latest with features=compat":
+"rust-latest with features=disable-validation":
extends: rust-latest
variables:
- FEATURES: "compat"
+ FEATURES: "disable-validation"
-"rust-nightly with features=compat":
+"rust-nightly with features=disable-validation":
extends: rust-nightly
variables:
- FEATURES: "compat"
+ FEATURES: "disable-validation"
diff --git a/Cargo.toml b/Cargo.toml
index 65935bab1f028d897229ee24541225749156fd59..0e3b9a36dbde483ea64a3f00074fcfd2d1a29199 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,5 +28,5 @@ try_from = "0.3.2"
[features]
# Build xmpp-parsers to make components instead of clients.
component = []
-# Compatibility mode
-compat = []
+# Disable validation of unknown attributes.
+disable-validation = []
diff --git a/src/attention.rs b/src/attention.rs
index c786f3137fce92ed8eb178329fda4ee4481a1da5..bd4c7a15e431cc8f5548cd837b96f97abbc59968 100644
--- a/src/attention.rs
+++ b/src/attention.rs
@@ -18,7 +18,7 @@ impl MessagePayload for Attention {}
#[cfg(test)]
mod tests {
use super::*;
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
use crate::error::Error;
use minidom::Element;
use try_from::TryFrom;
@@ -34,7 +34,7 @@ mod tests {
Attention::try_from(elem).unwrap();
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_child() {
let elem: Element = ""
@@ -48,7 +48,7 @@ mod tests {
assert_eq!(message, "Unknown child in attention element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = ""
diff --git a/src/bind.rs b/src/bind.rs
index bd09d4f3b36aa326f51790cc3f0ad0f905f6a2a0..9d3a894f8950c2aee20cda960de6b17acc6a4bac 100644
--- a/src/bind.rs
+++ b/src/bind.rs
@@ -112,7 +112,7 @@ mod tests {
assert_eq!(bind, Bind::None);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_resource() {
let elem: Element = "resource"
diff --git a/src/blocking.rs b/src/blocking.rs
index e12e7e49ae6757a078a2432892b3388f2551c60a..53417f7f749ccebc425fceeee2da39d63b03f337 100644
--- a/src/blocking.rs
+++ b/src/blocking.rs
@@ -168,7 +168,7 @@ mod tests {
assert_eq!(unblock.items, two_items);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid() {
let elem: Element = ""
@@ -211,7 +211,7 @@ mod tests {
assert_eq!(message, "Unknown attribute in unblock element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_non_empty_blocklist_request() {
let elem: Element = " ".parse().unwrap();
diff --git a/src/caps.rs b/src/caps.rs
index 3befdc9bc2541de8d5d401c362f4733124eecb03..74042be31a368be7a0d5b756a7393ec0ad77a09c 100644
--- a/src/caps.rs
+++ b/src/caps.rs
@@ -233,7 +233,7 @@ mod tests {
);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_child() {
let elem: Element = "K1Njy3HZBThlo4moOD5gBGhn0U0oK7/CbfLlIUDi6o4=".parse().unwrap();
diff --git a/src/chatstates.rs b/src/chatstates.rs
index 9a972aa79a4e97a820c62ac1f76275936240b214..4eb173f11b796d1ef554f7f766638de486efef6f 100644
--- a/src/chatstates.rs
+++ b/src/chatstates.rs
@@ -63,7 +63,7 @@ mod tests {
assert_eq!(message, "This is not a chatstate element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_child() {
let elem: Element = ""
@@ -77,7 +77,7 @@ mod tests {
assert_eq!(message, "Unknown child in chatstate element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = ""
diff --git a/src/jingle_ft.rs b/src/jingle_ft.rs
index d9a73b29b5fdd281c2091bb0f2bb5fa063003166..32dd41f6aeb7233bc5a236796ea7bfa6fa80418f 100644
--- a/src/jingle_ft.rs
+++ b/src/jingle_ft.rs
@@ -530,7 +530,7 @@ mod tests {
assert_eq!(message, "Unknown value for 'creator' attribute.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_received() {
let elem: Element = "".parse().unwrap();
@@ -596,7 +596,7 @@ mod tests {
assert_eq!(message, "Unknown value for 'creator' attribute.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_checksum() {
let elem: Element = "w0mcJylzCn+AfvuGdqkty2+KP48=".parse().unwrap();
@@ -637,7 +637,7 @@ mod tests {
assert_eq!(range2.hashes, hashes);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_range() {
let elem: Element = ""
diff --git a/src/macros.rs b/src/macros.rs
index daccec5c676346e14468723f34b9151e044972a2..aa89a45cbe2b6c429ef7c6300c75cc8fcc49621c 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -248,7 +248,7 @@ macro_rules! check_ns_only {
macro_rules! check_no_children {
($elem:ident, $name:tt) => {
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
for _ in $elem.children() {
return Err(crate::error::Error::ParseError(concat!(
"Unknown child in ",
@@ -261,7 +261,7 @@ macro_rules! check_no_children {
macro_rules! check_no_attributes {
($elem:ident, $name:tt) => {
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
for _ in $elem.attrs() {
return Err(crate::error::Error::ParseError(concat!(
"Unknown attribute in ",
@@ -274,7 +274,7 @@ macro_rules! check_no_attributes {
macro_rules! check_no_unknown_attributes {
($elem:ident, $name:tt, [$($attr:tt),*]) => (
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
for (_attr, _) in $elem.attrs() {
$(
if _attr == $attr {
diff --git a/src/message_correct.rs b/src/message_correct.rs
index e0d22d6257322d3a31bccbb32d20ed6cfb44ce0c..3bba10e7a187abf3cb1fcdb2e116a9b014fda2f8 100644
--- a/src/message_correct.rs
+++ b/src/message_correct.rs
@@ -45,7 +45,7 @@ mod tests {
Replace::try_from(elem).unwrap();
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = ""
diff --git a/src/muc/muc.rs b/src/muc/muc.rs
index 40528383da094ad9438d492d6ec92f95cf291540..fc596fa9c95adfe4f759cefead11bbabca89974e 100644
--- a/src/muc/muc.rs
+++ b/src/muc/muc.rs
@@ -142,7 +142,7 @@ mod tests {
assert_eq!(elem, elem2);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_muc_invalid_attribute() {
let elem: Element = ""
diff --git a/src/muc/user.rs b/src/muc/user.rs
index a104e319f9104715a22655c4901631cdad49d1a9..56c111e8ef18b7cd8a6be65a3544bdff4bb17efb 100644
--- a/src/muc/user.rs
+++ b/src/muc/user.rs
@@ -303,7 +303,7 @@ mod tests {
assert!(elem.compare_to(&elem2));
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = "
@@ -344,7 +344,7 @@ mod tests {
assert_eq!(message, "Required attribute 'code' missing.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_status_invalid_child() {
let elem: Element = "
@@ -515,7 +515,7 @@ mod tests {
assert_eq!(reason.0, "Reason".to_owned());
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_reason_invalid_attribute() {
let elem: Element = "
@@ -531,7 +531,7 @@ mod tests {
assert_eq!(message, "Unknown attribute in reason element.".to_owned());
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_reason_invalid() {
let elem: Element = "
@@ -549,7 +549,7 @@ mod tests {
assert_eq!(message, "Unknown child in reason element.".to_owned());
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_item_invalid_attr() {
let elem: Element = "
diff --git a/src/nick.rs b/src/nick.rs
index 67a45ff9c5342ea6c2216ec4a4f99865e0aae859..03f544aaa9455e9d9b8894972098676b9f898df2 100644
--- a/src/nick.rs
+++ b/src/nick.rs
@@ -14,7 +14,7 @@ generate_elem_id!(
#[cfg(test)]
mod tests {
use super::*;
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
use crate::error::Error;
use minidom::Element;
use try_from::TryFrom;
@@ -49,7 +49,7 @@ mod tests {
assert_eq!(elem1, elem2);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid() {
let elem: Element = ""
@@ -63,7 +63,7 @@ mod tests {
assert_eq!(message, "Unknown child in nick element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = ""
diff --git a/src/ping.rs b/src/ping.rs
index 6f48dd5592941854555995db680452f7a901ccaf..018531205c3d16f9b6b681251fe12091b1e091ab 100644
--- a/src/ping.rs
+++ b/src/ping.rs
@@ -20,7 +20,7 @@ impl IqGetPayload for Ping {}
#[cfg(test)]
mod tests {
use super::*;
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
use crate::error::Error;
use minidom::Element;
use try_from::TryFrom;
@@ -43,7 +43,7 @@ mod tests {
assert_eq!(elem1, elem2);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid() {
let elem: Element = ""
@@ -57,7 +57,7 @@ mod tests {
assert_eq!(message, "Unknown child in ping element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = "".parse().unwrap();
diff --git a/src/presence.rs b/src/presence.rs
index 20d63e879e48ac4af6f1a147b30010a785d215cd..7e3e8aa8f78a6afb68bfd7430467580f96a7e527 100644
--- a/src/presence.rs
+++ b/src/presence.rs
@@ -570,7 +570,7 @@ mod tests {
assert!(payload.is("test", "invalid"));
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_status_child() {
#[cfg(not(feature = "component"))]
@@ -590,7 +590,7 @@ mod tests {
assert_eq!(message, "Unknown child in status element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
#[cfg(not(feature = "component"))]
diff --git a/src/pubsub/event.rs b/src/pubsub/event.rs
index 0cad1cc0379fb9b7ad357821ad8f5a899057734b..0cef2c397c453bf00b9bddb5e08d43158a2a9e60 100644
--- a/src/pubsub/event.rs
+++ b/src/pubsub/event.rs
@@ -420,7 +420,7 @@ mod tests {
assert_eq!(message, "Unknown child in event element.");
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid_attribute() {
let elem: Element = ""
diff --git a/src/roster.rs b/src/roster.rs
index c0d869d1d0079196f04dfa651fbdce888178d721..c13b0f59ad1eed7cc791c8ac512a56b721056ebd 100644
--- a/src/roster.rs
+++ b/src/roster.rs
@@ -245,7 +245,7 @@ mod tests {
assert_eq!(roster.items[0].subscription, Subscription::Remove);
}
- #[cfg(not(feature = "compat"))]
+ #[cfg(not(feature = "disable-validation"))]
#[test]
fn test_invalid() {
let elem: Element = ""
diff --git a/src/sasl.rs b/src/sasl.rs
index 6f922901b2475da7cb72ecdcb6c55e47ddb30f17..45a56653fdc571d7df1b48165155732d5ba03e52 100644
--- a/src/sasl.rs
+++ b/src/sasl.rs
@@ -289,7 +289,7 @@ mod tests {
);
}
- #[cfg(feature = "compat")]
+ #[cfg(feature = "disable-validation")]
#[test]
fn failure_with_non_prefixed_text_lang() {
let elem: Element = "