mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-28 01:32:57 +01:00
Fix http/2 payload streaming #215
This commit is contained in:
parent
ba816a8562
commit
47d80382b2
@ -1,6 +1,8 @@
|
|||||||
# Changes
|
# 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
|
* Fix connector's default `keep-alive` and `lifetime` settings #212
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-web"
|
name = "actix-web"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
|
||||||
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -492,8 +492,8 @@ impl<S: 'static, H> ProcessResponse<S, H> {
|
|||||||
if let Some(err) = self.resp.error() {
|
if let Some(err) = self.resp.error() {
|
||||||
if self.resp.status().is_server_error() {
|
if self.resp.status().is_server_error() {
|
||||||
error!(
|
error!(
|
||||||
"Error occured during request handling: {}",
|
"Error occured during request handling, status: {} {}",
|
||||||
err
|
self.resp.status(), err
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
warn!(
|
warn!(
|
||||||
|
@ -787,10 +787,10 @@ mod tests {
|
|||||||
let mut app = App::new()
|
let mut app = App::new()
|
||||||
.scope("app", |scope| {
|
.scope("app", |scope| {
|
||||||
scope
|
scope
|
||||||
.route("/path1", Method::GET, |r: HttpRequest<_>| {
|
.route("/path1", Method::GET, |_: HttpRequest<_>| {
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
})
|
})
|
||||||
.route("/path1", Method::DELETE, |r: HttpRequest<_>| {
|
.route("/path1", Method::DELETE, |_: HttpRequest<_>| {
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -343,24 +343,27 @@ impl<H: 'static> Entry<H> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn poll_payload(&mut self) {
|
fn poll_payload(&mut self) {
|
||||||
if !self.flags.contains(EntryFlags::REOF) {
|
while !self.flags.contains(EntryFlags::REOF)
|
||||||
if self.payload.need_read() == PayloadStatus::Read {
|
&& 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))
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.recv.poll() {
|
match self.recv.poll() {
|
||||||
Ok(Async::Ready(Some(chunk))) => {
|
Ok(Async::Ready(Some(chunk))) => {
|
||||||
|
let l = chunk.len();
|
||||||
self.payload.feed_data(chunk);
|
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)) => {
|
Ok(Async::Ready(None)) => {
|
||||||
self.flags.insert(EntryFlags::REOF);
|
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);
|
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]
|
#[test]
|
||||||
|
Loading…
Reference in New Issue
Block a user