Remove now un-needed trim

This commit is contained in:
Travis Burtrum 2021-04-16 23:45:02 -04:00
parent 5c966d9166
commit dfd76c3218
2 changed files with 1 additions and 5 deletions

View File

@ -30,8 +30,6 @@ use stanzafilter::*;
const IN_BUFFER_SIZE: usize = 8192; const IN_BUFFER_SIZE: usize = 8192;
const OUT_BUFFER_SIZE: usize = 8192; const OUT_BUFFER_SIZE: usize = 8192;
pub const WHITESPACE: &[u8] = b" \t\n\r";
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
fn c2s(is_c2s: bool) -> &'static str { fn c2s(is_c2s: bool) -> &'static str {
if is_c2s { if is_c2s {
@ -160,7 +158,6 @@ async fn handle_connection(mut stream: tokio::net::TcpStream, client_addr: Socke
while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await { while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await {
debug!("received pre-tls stanza: {} '{}'", client_addr, to_str(&buf)); debug!("received pre-tls stanza: {} '{}'", client_addr, to_str(&buf));
let buf = buf.trim_start(WHITESPACE);
if buf.starts_with(b"<?xml ") { if buf.starts_with(b"<?xml ") {
debug!("> {} '{}'", client_addr, to_str(&buf)); debug!("> {} '{}'", client_addr, to_str(&buf));
in_wr.write_all(&buf).await?; in_wr.write_all(&buf).await?;
@ -218,7 +215,6 @@ async fn handle_connection(mut stream: tokio::net::TcpStream, client_addr: Socke
while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await { while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await {
debug!("received pre-<stream:stream> stanza: {} '{}'", client_addr, to_str(&buf)); debug!("received pre-<stream:stream> stanza: {} '{}'", client_addr, to_str(&buf));
let buf = buf.trim_start(WHITESPACE);
if buf.starts_with(b"<?xml ") { if buf.starts_with(b"<?xml ") {
stream_open.extend_from_slice(buf); stream_open.extend_from_slice(buf);
} else if buf.starts_with(b"<stream:stream ") { } else if buf.starts_with(b"<stream:stream ") {

View File

@ -67,7 +67,7 @@ impl<T: PartialEq + Clone> SliceSubsequence<T> for Vec<T> {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use crate::slicesubsequence::*; use crate::slicesubsequence::*;
use crate::WHITESPACE; const WHITESPACE: &[u8] = b" \t\n\r";
#[test] #[test]
fn trim_start() { fn trim_start() {