Closed
Description
I've adapted this code from client/response.rs
:
fn main() {
let stream = MockStream::with_input(b"\
HTTP/1.1 200 OK\r\n\
Transfer-Encoding: chunked\r\n\
Transfer-Encoding: chunked\r\n\
\r\n\
1\r\n\
q\r\n\
2\r\n\
we\r\n\
2\r\n\
rt\r\n\
0\r\n\
\r\n"
);
let url = Url::parse("http://hyper.rs").unwrap();
let mut res = Response::new(url, Box::new(stream)).unwrap();
let mut s = String::new();
res.read_to_string(&mut s).unwrap();
println!("{:?}", s);
}
The result is:
"1\r\nq\r\n2\r\nwe\r\n2\r\nrt\r\n0\r\n\r\n"
Unless I'm misreading the HTTP spec, it seems
HTTP/1.1 200 OK\r\n
Transfer-Encoding: chunked\r\n
Transfer-Encoding: chunked\r\n
should be the same as
HTTP/1.1 200 OK\r\n
Transfer-Encoding: chunked, chunked\r\n
The latter correctly results in "qwert"
being printed out.
Activity