feat(server): add upgrade support to lower-level Connection API (#1459)

Closes #1323
This commit is contained in:
Sean McArthur
2018-03-09 10:05:27 -08:00
committed by GitHub
parent eb15c660c1
commit d58aa73246
7 changed files with 229 additions and 104 deletions

View File

@@ -132,7 +132,11 @@ where
// replying with the latter status code response.
let ret = if ::StatusCode::SwitchingProtocols == head.subject {
T::on_encode_upgrade(&mut head)
.map(|_| Server::set_length(&mut head, has_body, method.as_ref()))
.map(|_| {
let mut enc = Server::set_length(&mut head, has_body, method.as_ref());
enc.set_last();
enc
})
} else if head.subject.is_informational() {
error!("response with 1xx status code not supported");
head = MessageHead::default();