1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-03 09:36:36 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
6813ce789d add x509 to stream extension (#844) 2019-05-15 08:38:59 -07:00
cc6e0c6d04 Fix client payload decompression #674 2019-03-28 20:40:25 -07:00
d9496d46d1 [0.7] Fix never-ending HTTP2 empty response (#737)
* Fix never-ending HTTP2 empty response #737
2019-03-28 17:40:12 -07:00
5 changed files with 34 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Changes
## [x.x.xx] - xxxx-xx-xx
## [0.7.19] - 2019-03-29
### Added
@ -20,6 +20,11 @@
* Fix preflight CORS header compliance; refactor previous patch (#603). #717
* Fix never-ending HTTP2 request when response is empty (#709). #737
* Fix client payload decompression #674
## [0.7.18] - 2019-01-10
### Added

View File

@ -1,6 +1,6 @@
[package]
name = "actix-web"
version = "0.7.18"
version = "0.7.19"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix web is a simple, pragmatic and extremely fast web framework for Rust."
readme = "README.md"

View File

@ -6,8 +6,8 @@ use std::time::{Duration, Instant};
use std::{io, mem};
use tokio_timer::Delay;
use actix_inner::dev::Request;
use actix::{Addr, SystemService};
use actix_inner::dev::Request;
use super::{
ClientConnector, ClientConnectorError, ClientRequest, ClientResponse, Connect,
@ -88,7 +88,8 @@ impl SendRequest {
}
pub(crate) fn with_connector(
req: ClientRequest, conn: Addr<ClientConnector>,
req: ClientRequest,
conn: Addr<ClientConnector>,
) -> SendRequest {
SendRequest {
req,
@ -363,11 +364,11 @@ impl Pipeline {
if let Some(ref mut decompress) = self.decompress {
match decompress.feed_data(b) {
Ok(Some(b)) => return Ok(Async::Ready(Some(b))),
Ok(None) => return Ok(Async::NotReady),
Ok(None) => continue,
Err(ref err)
if err.kind() == io::ErrorKind::WouldBlock =>
{
continue
continue;
}
Err(err) => return Err(err.into()),
}

View File

@ -234,6 +234,16 @@ impl<H: 'static> Writer for H2Writer<H> {
stream.reserve_capacity(cmp::min(self.buffer.len(), CHUNK_SIZE));
}
if self.flags.contains(Flags::EOF)
&& !self.flags.contains(Flags::RESERVED)
&& self.buffer.is_empty()
{
if let Err(e) = stream.send_data(Bytes::new(), true) {
return Err(io::Error::new(io::ErrorKind::Other, e));
}
return Ok(Async::Ready(()));
}
loop {
match stream.poll_capacity() {
Ok(Async::NotReady) => return Ok(Async::NotReady),

View File

@ -1,4 +1,5 @@
use std::net::{Shutdown, SocketAddr};
use std::rc::Rc;
use std::{io, time};
use actix_net::ssl;
@ -6,6 +7,7 @@ use openssl::ssl::{AlpnError, SslAcceptor, SslAcceptorBuilder};
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_openssl::SslStream;
use extensions::Extensions;
use server::{IoStream, ServerFlags};
/// Support `SSL` connections via openssl package
@ -84,4 +86,14 @@ impl<T: IoStream> IoStream for SslStream<T> {
fn set_keepalive(&mut self, dur: Option<time::Duration>) -> io::Result<()> {
self.get_mut().get_mut().set_keepalive(dur)
}
fn extensions(&self) -> Option<Rc<Extensions>> {
if let Some(x509) = self.get_ref().ssl().peer_certificate() {
let mut extensions = Extensions::new();
extensions.insert(x509);
Some(Rc::new(extensions))
} else {
None
}
}
}