Stop being pedantic by default
Up to now, the xmpp-rs projects have been very strict about incoming
data. This has served us, as developers of the libraries, well,
uncovering bugs in our and remote implementations which we could then
get fixed.
However, this behaviour is unexpected to users of the library. In the
XMPP world, unexpected child elements and attributes are generally
expected to be ignored. While this could be opted-into previously, the
feature flag for that sounded more dangerous than it was
("disable-validation"). In addition, the tribal knowledge needed to know
about that feature flag may not have reached some people who tried the
library and gave up because of that.
With this change, we make the non-pedantic behaviour the default. For
development and debugging purposes, users can always opt into the
pedantic behaviour as needed, using the newly-introduced `pedantic`
feature flags on all affected crates.
This commit is contained in:
parent
65c1f5ab10
commit
e2dcd8ac66
41 changed files with 99 additions and 107 deletions
|
|
@ -62,7 +62,7 @@ pub struct Blocked;
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[cfg(not(feature = "disable-validation"))]
|
||||
#[cfg(feature = "pedantic")]
|
||||
use xso::error::{Error, FromElementError};
|
||||
|
||||
use super::*;
|
||||
|
|
@ -126,7 +126,7 @@ mod tests {
|
|||
assert_eq!(unblock.items, two_items);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "disable-validation"))]
|
||||
#[cfg(feature = "pedantic")]
|
||||
#[test]
|
||||
fn test_invalid() {
|
||||
let elem: Element = "<blocklist xmlns='urn:xmpp:blocking' coucou=''/>"
|
||||
|
|
@ -169,7 +169,7 @@ mod tests {
|
|||
assert_eq!(message, "Unknown attribute in Unblock element.");
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "disable-validation"))]
|
||||
#[cfg(feature = "pedantic")]
|
||||
#[test]
|
||||
fn test_non_empty_blocklist_request() {
|
||||
let elem: Element = "<blocklist xmlns='urn:xmpp:blocking'><item jid='coucou@coucou'/><item jid='domain'/></blocklist>".parse().unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue