parsers: fix text field namespacing in StreamError
skip-changelog
This commit is contained in:
parent
0ebc3ca04c
commit
7c87d879d8
6 changed files with 198 additions and 75 deletions
|
|
@ -572,15 +572,11 @@ impl ConnectedState {
|
|||
}
|
||||
} else {
|
||||
log::warn!("Got an <sm:r/> from the peer, but we don't have any stream management state. Terminating stream with an error.");
|
||||
self.to_stream_error_state(StreamError {
|
||||
condition: DefinedCondition::UnsupportedStanzaType,
|
||||
text: Some((
|
||||
None,
|
||||
"received <sm:r/>, but stream management is not enabled"
|
||||
.to_owned(),
|
||||
)),
|
||||
application_specific: vec![],
|
||||
});
|
||||
self.to_stream_error_state(StreamError::new(
|
||||
DefinedCondition::UnsupportedStanzaType,
|
||||
"en",
|
||||
"received <sm:r/>, but stream management is not enabled".to_owned(),
|
||||
));
|
||||
}
|
||||
// No matter whether we "enqueued" an ACK for send or
|
||||
// whether we just successfully read something from
|
||||
|
|
@ -593,13 +589,13 @@ impl ConnectedState {
|
|||
log::warn!(
|
||||
"Received unsupported stream element: {other:?}. Emitting stream error.",
|
||||
);
|
||||
self.to_stream_error_state(StreamError {
|
||||
condition: DefinedCondition::UnsupportedStanzaType,
|
||||
// TODO: figure out a good way to provide the
|
||||
// sender with more information.
|
||||
text: None,
|
||||
application_specific: vec![],
|
||||
});
|
||||
// TODO: figure out a good way to provide the sender
|
||||
// with more information.
|
||||
self.to_stream_error_state(StreamError::new(
|
||||
DefinedCondition::UnsupportedStanzaType,
|
||||
"en",
|
||||
format!("Unsupported stream element: {other:?}"),
|
||||
));
|
||||
Poll::Ready(None)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,11 +232,12 @@ impl NegotiationState {
|
|||
};
|
||||
log::warn!("Received IQ matching the bind request, but parsing failed ({error})! Emitting stream error.");
|
||||
Poll::Ready(Break(NegotiationResult::StreamError {
|
||||
error: StreamError {
|
||||
condition: DefinedCondition::UndefinedCondition,
|
||||
text: Some((None, error)),
|
||||
application_specific: vec![super::error::ParseError.into()],
|
||||
},
|
||||
error: StreamError::new(
|
||||
DefinedCondition::UndefinedCondition,
|
||||
"en",
|
||||
error,
|
||||
)
|
||||
.with_application_specific(vec![super::error::ParseError.into()]),
|
||||
}))
|
||||
}
|
||||
st => {
|
||||
|
|
@ -258,11 +259,11 @@ impl NegotiationState {
|
|||
Ok(other) => {
|
||||
log::warn!("Received unsupported stream element during bind: {other:?}. Emitting stream error.");
|
||||
Poll::Ready(Break(NegotiationResult::StreamError {
|
||||
error: StreamError {
|
||||
condition: DefinedCondition::UnsupportedStanzaType,
|
||||
text: None,
|
||||
application_specific: vec![],
|
||||
},
|
||||
error: StreamError::new(
|
||||
DefinedCondition::UnsupportedStanzaType,
|
||||
"en",
|
||||
format!("Unsupported stream element during bind: {other:?}"),
|
||||
),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
@ -483,11 +484,11 @@ impl NegotiationState {
|
|||
Ok(other) => {
|
||||
log::warn!("Received unsupported stream element during negotiation: {other:?}. Emitting stream error.");
|
||||
Poll::Ready(Break(NegotiationResult::StreamError {
|
||||
error: StreamError {
|
||||
condition: DefinedCondition::UnsupportedStanzaType,
|
||||
text: None,
|
||||
application_specific: vec![],
|
||||
},
|
||||
error: StreamError::new(
|
||||
DefinedCondition::UnsupportedStanzaType,
|
||||
"en",
|
||||
format!("Unsupported stream element during negotiation: {other:?}"),
|
||||
),
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -401,11 +401,7 @@ pub(super) fn parse_error_to_stream_error(e: xso::error::Error) -> StreamError {
|
|||
Error::TextParseError(_) | Error::Other(_) => DefinedCondition::InvalidXml,
|
||||
Error::TypeMismatch => DefinedCondition::UnsupportedStanzaType,
|
||||
};
|
||||
StreamError {
|
||||
condition,
|
||||
text: Some((None, e.to_string())),
|
||||
application_specific: vec![],
|
||||
}
|
||||
StreamError::new(condition, "en", e.to_string())
|
||||
}
|
||||
|
||||
/// Worker system for a [`StanzaStream`].
|
||||
|
|
|
|||
Loading…
Reference in a new issue