mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
set server response version
This commit is contained in:
parent
186d3d727a
commit
ab3e12f2b4
@ -149,6 +149,9 @@ impl Encoder for Codec {
|
||||
) -> Result<(), Self::Error> {
|
||||
match item {
|
||||
Message::Item((mut res, length)) => {
|
||||
// set response version
|
||||
res.head_mut().version = self.version;
|
||||
|
||||
// connection status
|
||||
self.ctype = if let Some(ct) = res.head().ctype {
|
||||
if ct == ConnectionType::KeepAlive {
|
||||
|
@ -137,7 +137,7 @@ fn test_keepalive_http10_default_close() {
|
||||
let _ = stream.write_all(b"GET /test/tests/test HTTP/1.0\r\n\r\n");
|
||||
let mut data = vec![0; 1024];
|
||||
let _ = stream.read(&mut data);
|
||||
assert_eq!(&data[..17], b"HTTP/1.1 200 OK\r\n");
|
||||
assert_eq!(&data[..17], b"HTTP/1.0 200 OK\r\n");
|
||||
|
||||
let mut data = vec![0; 1024];
|
||||
let res = stream.read(&mut data).unwrap();
|
||||
@ -157,13 +157,13 @@ fn test_keepalive_http10() {
|
||||
.write_all(b"GET /test/tests/test HTTP/1.0\r\nconnection: keep-alive\r\n\r\n");
|
||||
let mut data = vec![0; 1024];
|
||||
let _ = stream.read(&mut data);
|
||||
assert_eq!(&data[..17], b"HTTP/1.1 200 OK\r\n");
|
||||
assert_eq!(&data[..17], b"HTTP/1.0 200 OK\r\n");
|
||||
|
||||
let mut stream = net::TcpStream::connect(srv.addr()).unwrap();
|
||||
let _ = stream.write_all(b"GET /test/tests/test HTTP/1.0\r\n\r\n");
|
||||
let mut data = vec![0; 1024];
|
||||
let _ = stream.read(&mut data);
|
||||
assert_eq!(&data[..17], b"HTTP/1.1 200 OK\r\n");
|
||||
assert_eq!(&data[..17], b"HTTP/1.0 200 OK\r\n");
|
||||
|
||||
let mut data = vec![0; 1024];
|
||||
let res = stream.read(&mut data).unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user