mirror of
https://github.com/actix/actix-web.git
synced 2024-12-23 00:26:34 +00:00
Fix http/2 payload streaming #215
This commit is contained in:
parent
ba816a8562
commit
47d80382b2
6 changed files with 23 additions and 18 deletions
|
@ -1,6 +1,8 @@
|
|||
# Changes
|
||||
|
||||
## 0.6.1 (2018-05-xx)
|
||||
## 0.6.1 (2018-05-08)
|
||||
|
||||
* Fix http/2 payload streaming #215
|
||||
|
||||
* Fix connector's default `keep-alive` and `lifetime` settings #212
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "actix-web"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||
readme = "README.md"
|
||||
|
|
|
@ -492,8 +492,8 @@ impl<S: 'static, H> ProcessResponse<S, H> {
|
|||
if let Some(err) = self.resp.error() {
|
||||
if self.resp.status().is_server_error() {
|
||||
error!(
|
||||
"Error occured during request handling: {}",
|
||||
err
|
||||
"Error occured during request handling, status: {} {}",
|
||||
self.resp.status(), err
|
||||
);
|
||||
} else {
|
||||
warn!(
|
||||
|
|
|
@ -787,10 +787,10 @@ mod tests {
|
|||
let mut app = App::new()
|
||||
.scope("app", |scope| {
|
||||
scope
|
||||
.route("/path1", Method::GET, |r: HttpRequest<_>| {
|
||||
.route("/path1", Method::GET, |_: HttpRequest<_>| {
|
||||
HttpResponse::Ok()
|
||||
})
|
||||
.route("/path1", Method::DELETE, |r: HttpRequest<_>| {
|
||||
.route("/path1", Method::DELETE, |_: HttpRequest<_>| {
|
||||
HttpResponse::Ok()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -343,24 +343,27 @@ impl<H: 'static> Entry<H> {
|
|||
}
|
||||
|
||||
fn poll_payload(&mut self) {
|
||||
if !self.flags.contains(EntryFlags::REOF) {
|
||||
if self.payload.need_read() == PayloadStatus::Read {
|
||||
if let Err(err) = self.recv.release_capacity().release_capacity(32_768) {
|
||||
self.payload.set_error(PayloadError::Http2(err))
|
||||
}
|
||||
} else if let Err(err) = self.recv.release_capacity().release_capacity(0) {
|
||||
self.payload.set_error(PayloadError::Http2(err))
|
||||
}
|
||||
|
||||
while !self.flags.contains(EntryFlags::REOF)
|
||||
&& self.payload.need_read() == PayloadStatus::Read
|
||||
{
|
||||
match self.recv.poll() {
|
||||
Ok(Async::Ready(Some(chunk))) => {
|
||||
let l = chunk.len();
|
||||
self.payload.feed_data(chunk);
|
||||
if let Err(err) = self.recv.release_capacity().release_capacity(l) {
|
||||
self.payload.set_error(PayloadError::Http2(err));
|
||||
break;
|
||||
}
|
||||
}
|
||||
Ok(Async::Ready(None)) => {
|
||||
self.flags.insert(EntryFlags::REOF);
|
||||
self.payload.feed_eof();
|
||||
}
|
||||
Ok(Async::NotReady) => break,
|
||||
Err(err) => {
|
||||
self.payload.set_error(PayloadError::Http2(err));
|
||||
break;
|
||||
}
|
||||
Ok(Async::NotReady) => (),
|
||||
Err(err) => self.payload.set_error(PayloadError::Http2(err)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -809,7 +809,7 @@ fn test_h2() {
|
|||
})
|
||||
});
|
||||
let _res = core.run(tcp);
|
||||
// assert_eq!(res.unwrap(), Bytes::from_static(STR.as_ref()));
|
||||
// assert_eq!(_res.unwrap(), Bytes::from_static(STR.as_ref()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue