From c6ab5a22b89467b1390247a18fc93f487e29d197 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Wed, 12 Jun 2019 16:44:13 +0200 Subject: [PATCH] Update xml5ever. --- Cargo.toml | 2 +- src/xmpp_codec.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3bcdbd2..db18052 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ tokio = "0.1" tokio-io = "0.1" tokio-codec = "0.1" bytes = "0.4" -xml5ever = "0.12" +xml5ever = "0.14" native-tls = "0.2" tokio-tls = "0.2" sasl = "0.4" diff --git a/src/xmpp_codec.rs b/src/xmpp_codec.rs index 3920ba4..0002087 100644 --- a/src/xmpp_codec.rs +++ b/src/xmpp_codec.rs @@ -18,6 +18,7 @@ use std::borrow::Cow; use tokio_codec::{Decoder, Encoder}; use xml5ever::interface::Attribute; use xml5ever::tokenizer::{Tag, TagKind, Token, TokenSink, XmlTokenizer}; +use xml5ever::buffer_queue::BufferQueue; /// Anything that can be sent or received on an XMPP/XML stream #[derive(Debug, Clone, PartialEq, Eq)] @@ -231,8 +232,10 @@ impl Decoder for XMPPCodec { Ok(s) => { if !s.is_empty() { // println!("<< {}", s); + let mut buffer_queue = BufferQueue::new(); let tendril = FromIterator::from_iter(s.chars()); - self.parser.feed(tendril); + buffer_queue.push_back(tendril); + self.parser.feed(&mut buffer_queue); } } // Remedies for truncated utf8