Fix warnings

Signed-off-by: Alexey Galakhov <agalakhov@snapview.de>
pull/7/head
Alexey Galakhov 8 years ago
parent 037dea1f8e
commit 53aa24b06b
  1. 4
      src/handshake/client.rs
  2. 12
      src/handshake/headers.rs
  3. 8
      src/handshake/server.rs
  4. 3
      src/protocol/mod.rs

@ -207,8 +207,8 @@ mod tests {
#[test]
fn response_parsing() {
const data: &'static [u8] = b"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
let (_, resp) = Response::try_parse(data).unwrap().unwrap();
const DATA: &'static [u8] = b"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
let (_, resp) = Response::try_parse(DATA).unwrap().unwrap();
assert_eq!(resp.code, 200);
assert_eq!(resp.headers.find_first("Content-Type"), Some(&b"text/html"[..]));
}

@ -101,12 +101,12 @@ mod tests {
#[test]
fn headers() {
const data: &'static [u8] =
const DATA: &'static [u8] =
b"Host: foo.com\r\n\
Connection: Upgrade\r\n\
Upgrade: websocket\r\n\
\r\n";
let (_, hdr) = Headers::try_parse(data).unwrap().unwrap();
let (_, hdr) = Headers::try_parse(DATA).unwrap().unwrap();
assert_eq!(hdr.find_first("Host"), Some(&b"foo.com"[..]));
assert_eq!(hdr.find_first("Upgrade"), Some(&b"websocket"[..]));
assert_eq!(hdr.find_first("Connection"), Some(&b"Upgrade"[..]));
@ -118,14 +118,14 @@ mod tests {
#[test]
fn headers_iter() {
const data: &'static [u8] =
const DATA: &'static [u8] =
b"Host: foo.com\r\n\
Sec-WebSocket-Extensions: permessage-deflate\r\n\
Connection: Upgrade\r\n\
Sec-WebSocket-ExtenSIONS: permessage-unknown\r\n\
Upgrade: websocket\r\n\
\r\n";
let (_, hdr) = Headers::try_parse(data).unwrap().unwrap();
let (_, hdr) = Headers::try_parse(DATA).unwrap().unwrap();
let mut iter = hdr.find("Sec-WebSocket-Extensions");
assert_eq!(iter.next(), Some(&b"permessage-deflate"[..]));
assert_eq!(iter.next(), Some(&b"permessage-unknown"[..]));
@ -134,11 +134,11 @@ mod tests {
#[test]
fn headers_incomplete() {
const data: &'static [u8] =
const DATA: &'static [u8] =
b"Host: foo.com\r\n\
Connection: Upgrade\r\n\
Upgrade: websocket\r\n";
let hdr = Headers::try_parse(data).unwrap();
let hdr = Headers::try_parse(DATA).unwrap();
assert!(hdr.is_none());
}

@ -99,15 +99,15 @@ mod tests {
#[test]
fn request_parsing() {
const data: &'static [u8] = b"GET /script.ws HTTP/1.1\r\nHost: foo.com\r\n\r\n";
let (_, req) = Request::try_parse(data).unwrap().unwrap();
const DATA: &'static [u8] = b"GET /script.ws HTTP/1.1\r\nHost: foo.com\r\n\r\n";
let (_, req) = Request::try_parse(DATA).unwrap().unwrap();
assert_eq!(req.path, "/script.ws");
assert_eq!(req.headers.find_first("Host"), Some(&b"foo.com"[..]));
}
#[test]
fn request_replying() {
const data: &'static [u8] = b"\
const DATA: &'static [u8] = b"\
GET /script.ws HTTP/1.1\r\n\
Host: foo.com\r\n\
Connection: upgrade\r\n\
@ -115,7 +115,7 @@ mod tests {
Sec-WebSocket-Version: 13\r\n\
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n\
\r\n";
let (_, req) = Request::try_parse(data).unwrap().unwrap();
let (_, req) = Request::try_parse(DATA).unwrap().unwrap();
let _ = req.reply().unwrap();
}

@ -1,6 +1,7 @@
//! Generic WebSocket protocol implementation
mod frame;
pub mod frame;
mod message;
pub use self::message::Message;

Loading…
Cancel
Save