Track HTTP crate

This commit is contained in:
Carl Lerche
2017-09-05 10:21:31 -07:00
parent b4fa5134f9
commit c2e6eb35d8
15 changed files with 50 additions and 48 deletions

View File

@@ -1,7 +1,9 @@
use super::{huffman, Header};
use frame;
use http::{method, header, status};
use http::{header};
use http::method::{self, Method};
use http::status::{self, StatusCode};
use bytes::{Buf, Bytes, BytesMut};
use string::String;
@@ -544,24 +546,24 @@ impl From<DecoderError> for frame::Error {
/// Get an entry from the static table
pub fn get_static(idx: usize) -> Header {
use http::{status, method, header};
use http::header;
use http::header::HeaderValue;
match idx {
1 => Header::Authority(from_static("")),
2 => Header::Method(method::GET),
3 => Header::Method(method::POST),
2 => Header::Method(Method::GET),
3 => Header::Method(Method::POST),
4 => Header::Path(from_static("/")),
5 => Header::Path(from_static("/index.html")),
6 => Header::Scheme(from_static("http")),
7 => Header::Scheme(from_static("https")),
8 => Header::Status(status::OK),
9 => Header::Status(status::NO_CONTENT),
10 => Header::Status(status::PARTIAL_CONTENT),
11 => Header::Status(status::NOT_MODIFIED),
12 => Header::Status(status::BAD_REQUEST),
13 => Header::Status(status::NOT_FOUND),
14 => Header::Status(status::INTERNAL_SERVER_ERROR),
8 => Header::Status(StatusCode::OK),
9 => Header::Status(StatusCode::NO_CONTENT),
10 => Header::Status(StatusCode::PARTIAL_CONTENT),
11 => Header::Status(StatusCode::NOT_MODIFIED),
12 => Header::Status(StatusCode::BAD_REQUEST),
13 => Header::Status(StatusCode::NOT_FOUND),
14 => Header::Status(StatusCode::INTERNAL_SERVER_ERROR),
15 => Header::Field {
name: header::ACCEPT_CHARSET,
value: HeaderValue::from_static(""),

View File

@@ -1,7 +1,8 @@
use super::Header;
use fnv::FnvHasher;
use http::{method, header};
use http::header;
use http::method::Method;
use std::{cmp, mem, usize};
use std::collections::VecDeque;
@@ -721,8 +722,8 @@ fn index_static(header: &Header) -> Option<(usize, bool)> {
Header::Authority(_) => Some((1, false)),
Header::Method(ref v) => {
match *v {
method::GET => Some((2, true)),
method::POST => Some((3, true)),
Method::GET => Some((2, true)),
Method::POST => Some((3, true)),
_ => Some((2, false)),
}
}

View File

@@ -176,8 +176,7 @@ impl Arbitrary for FuzzHpack {
}
fn gen_header(g: &mut StdRng) -> Header<Option<HeaderName>> {
use http::StatusCode;
use http::method::{self, Method};
use http::{Method, StatusCode};
if g.gen_weighted_bool(10) {
match g.next_u32() % 5 {
@@ -187,11 +186,11 @@ fn gen_header(g: &mut StdRng) -> Header<Option<HeaderName>> {
}
1 => {
let method = match g.next_u32() % 6 {
0 => method::GET,
1 => method::POST,
2 => method::PUT,
3 => method::PATCH,
4 => method::DELETE,
0 => Method::GET,
1 => Method::POST,
2 => Method::PUT,
3 => Method::PATCH,
4 => Method::DELETE,
5 => {
let n: usize = g.gen_range(3, 7);
let bytes: Vec<u8> = (0..n).map(|_| {