v0.29.6
This commit is contained in:
1 parent
3e33982cd3
commit
ad95bfb050
27 files changed
+309
-80
No files matched your search
@@ -178,9 +178,7 @@ async fn php_response_inner(
|
||||
permit,
|
||||
));
|
||||
let mut response = Response::new(if send_body {
|
||||
Body::from_stream(stream::unfold(rx, |mut rx| async move {
|
||||
rx.recv().await.map(|item| (item, rx))
|
||||
}))
|
||||
Body::from_stream(fastcgi_body_stream(rx))
|
||||
} else {
|
||||
Body::empty()
|
||||
});
|
||||
@@ -189,6 +187,18 @@ async fn php_response_inner(
|
||||
response
|
||||
}
|
||||
|
||||
// tower-http's compression encoder may poll a body again after observing EOF.
|
||||
// An unfused `stream::unfold` panics on that second poll, aborting the response
|
||||
// before the encoder can emit its final gzip/br/zstd bytes.
|
||||
pub(super) fn fastcgi_body_stream(
|
||||
rx: mpsc::Receiver<io::Result<Bytes>>,
|
||||
) -> impl futures_util::Stream<Item = io::Result<Bytes>> {
|
||||
stream::unfold(rx, |mut rx| async move {
|
||||
rx.recv().await.map(|item| (item, rx))
|
||||
})
|
||||
.fuse()
|
||||
}
|
||||
|
||||
pub(super) fn method_not_allowed_response() -> Response {
|
||||
let mut response = status_response(
|
||||
StatusCode::METHOD_NOT_ALLOWED,
|
||||
|
||||
Reference in new issue
Block a user