mirror of
https://github.com/actix/actix-web.git
synced 2024-12-30 03:50:42 +00:00
travis config
This commit is contained in:
parent
49cdddf479
commit
1a31554ee6
3 changed files with 47 additions and 28 deletions
34
.travis.yml
34
.travis.yml
|
@ -1,14 +1,27 @@
|
|||
language: rust
|
||||
|
||||
rust:
|
||||
- 1.20.0
|
||||
- stable
|
||||
- beta
|
||||
- nightly-2018-01-03
|
||||
|
||||
sudo: required
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
cache:
|
||||
cargo: true
|
||||
apt: true
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- rust: 1.20.0
|
||||
- rust: stable
|
||||
- rust: beta
|
||||
- rust: nightly
|
||||
allow_failures:
|
||||
- rust: nightly
|
||||
- rust: beta
|
||||
|
||||
#rust:
|
||||
# - 1.20.0
|
||||
# - stable
|
||||
# - beta
|
||||
# - nightly-2018-01-03
|
||||
|
||||
env:
|
||||
global:
|
||||
- RUSTFLAGS="-C link-dead-code"
|
||||
|
@ -42,9 +55,6 @@ script:
|
|||
cd examples/multipart && cargo check && cd ../..
|
||||
cd examples/json && cargo check && cd ../..
|
||||
cd examples/template_tera && cargo check && cd ../..
|
||||
fi
|
||||
- |
|
||||
if [[ "$TRAVIS_RUST_VERSION" == "beta" ]]; then
|
||||
cd examples/diesel && cargo check && cd ../..
|
||||
cd examples/tls && cargo check && cd ../..
|
||||
cd examples/websocket-chat && cargo check && cd ../..
|
||||
|
@ -58,7 +68,7 @@ script:
|
|||
# Upload docs
|
||||
after_success:
|
||||
- |
|
||||
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_RUST_VERSION" == "nightly-2018-01-03" ]]; then
|
||||
if [[ "$TRAVIS_OS_NAME" == "linux" && "$TRAVIS_PULL_REQUEST" = "false" && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
|
||||
cargo doc --features alpn --no-deps &&
|
||||
echo "<meta http-equiv=refresh content=0;url=os_balloon/index.html>" > target/doc/index.html &&
|
||||
cargo install mdbook &&
|
||||
|
|
|
@ -36,6 +36,7 @@ pub enum ContentEncoding {
|
|||
|
||||
impl ContentEncoding {
|
||||
|
||||
#[inline]
|
||||
fn is_compression(&self) -> bool {
|
||||
match *self {
|
||||
ContentEncoding::Identity | ContentEncoding::Auto => false,
|
||||
|
@ -51,7 +52,7 @@ impl ContentEncoding {
|
|||
ContentEncoding::Identity | ContentEncoding::Auto => "identity",
|
||||
}
|
||||
}
|
||||
// default quality
|
||||
/// default quality value
|
||||
fn quality(&self) -> f64 {
|
||||
match *self {
|
||||
ContentEncoding::Br => 1.1,
|
||||
|
@ -62,6 +63,7 @@ impl ContentEncoding {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: remove memory allocation
|
||||
impl<'a> From<&'a str> for ContentEncoding {
|
||||
fn from(s: &'a str) -> ContentEncoding {
|
||||
match s.trim().to_lowercase().as_ref() {
|
||||
|
@ -157,11 +159,7 @@ impl EncodedPayload {
|
|||
Box::new(GzDecoder::new(BytesMut::with_capacity(8192).writer()))),
|
||||
_ => Decoder::Identity,
|
||||
};
|
||||
EncodedPayload {
|
||||
inner: inner,
|
||||
decoder: dec,
|
||||
error: false,
|
||||
}
|
||||
EncodedPayload{ inner: inner, decoder: dec, error: false }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +252,7 @@ impl PayloadWriter for EncodedPayload {
|
|||
}
|
||||
return
|
||||
}
|
||||
trace!("Error decoding gzip encoding");
|
||||
}
|
||||
|
||||
Decoder::Deflate(ref mut decoder) => {
|
||||
|
@ -417,8 +416,7 @@ impl PayloadEncoder {
|
|||
ContentEncoding::Br => ContentEncoder::Br(
|
||||
BrotliEncoder::new(transfer, 5)),
|
||||
ContentEncoding::Identity => ContentEncoder::Identity(transfer),
|
||||
ContentEncoding::Auto =>
|
||||
unreachable!()
|
||||
ContentEncoding::Auto => unreachable!()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -643,10 +641,8 @@ impl TransferEncoding {
|
|||
pub fn is_eof(&self) -> bool {
|
||||
match self.kind {
|
||||
TransferEncodingKind::Eof => true,
|
||||
TransferEncodingKind::Chunked(ref eof) =>
|
||||
*eof,
|
||||
TransferEncodingKind::Length(ref remaining) =>
|
||||
*remaining == 0,
|
||||
TransferEncodingKind::Chunked(ref eof) => *eof,
|
||||
TransferEncodingKind::Length(ref remaining) => *remaining == 0,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -70,61 +70,73 @@ impl Payload {
|
|||
}
|
||||
|
||||
/// Indicates EOF of payload
|
||||
#[inline]
|
||||
pub fn eof(&self) -> bool {
|
||||
self.inner.borrow().eof()
|
||||
}
|
||||
|
||||
/// Length of the data in this payload
|
||||
#[inline]
|
||||
pub fn len(&self) -> usize {
|
||||
self.inner.borrow().len()
|
||||
}
|
||||
|
||||
/// Is payload empty
|
||||
#[inline]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.inner.borrow().len() == 0
|
||||
}
|
||||
|
||||
/// Get first available chunk of data.
|
||||
#[inline]
|
||||
pub fn readany(&self) -> ReadAny {
|
||||
ReadAny(Rc::clone(&self.inner))
|
||||
}
|
||||
|
||||
/// Get exact number of bytes
|
||||
#[inline]
|
||||
pub fn readexactly(&self, size: usize) -> ReadExactly {
|
||||
ReadExactly(Rc::clone(&self.inner), size)
|
||||
}
|
||||
|
||||
/// Read until `\n`
|
||||
#[inline]
|
||||
pub fn readline(&self) -> ReadLine {
|
||||
ReadLine(Rc::clone(&self.inner))
|
||||
}
|
||||
|
||||
/// Read until match line
|
||||
#[inline]
|
||||
pub fn readuntil(&self, line: &[u8]) -> ReadUntil {
|
||||
ReadUntil(Rc::clone(&self.inner), line.to_vec())
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[inline]
|
||||
pub fn readall(&self) -> Option<Bytes> {
|
||||
self.inner.borrow_mut().readall()
|
||||
}
|
||||
|
||||
/// Put unused data back to payload
|
||||
#[inline]
|
||||
pub fn unread_data(&mut self, data: Bytes) {
|
||||
self.inner.borrow_mut().unread_data(data);
|
||||
}
|
||||
|
||||
/// Get size of payload buffer
|
||||
#[inline]
|
||||
pub fn buffer_size(&self) -> usize {
|
||||
self.inner.borrow().buffer_size()
|
||||
}
|
||||
|
||||
/// Set size of payload buffer
|
||||
#[inline]
|
||||
pub fn set_buffer_size(&self, size: usize) {
|
||||
self.inner.borrow_mut().set_buffer_size(size)
|
||||
}
|
||||
|
||||
/// Convert payload into compatible `HttpResponse` body stream
|
||||
#[inline]
|
||||
pub fn stream(self) -> BodyStream {
|
||||
Box::new(self.map(|i| i.0).map_err(|e| e.into()))
|
||||
}
|
||||
|
@ -134,6 +146,7 @@ impl Stream for Payload {
|
|||
type Item = PayloadItem;
|
||||
type Error = PayloadError;
|
||||
|
||||
#[inline]
|
||||
fn poll(&mut self) -> Poll<Option<PayloadItem>, PayloadError> {
|
||||
self.inner.borrow_mut().readany()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue