Unverified Commit 3e3017fe authored by Nugine's avatar Nugine
Browse files

s3s: http: full_body: remove default limit

parent 0ebcd98d
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -9,8 +9,6 @@ use hyper::Body;

pub struct LengthLimit(pub u64);

pub const DEFAULT_LENGTH_LIMIT: u64 = 2 * 1024 * 1024;

pub struct FullBody(pub Bytes);

impl FullBody {
@@ -22,7 +20,11 @@ impl FullBody {
    pub async fn extract_with_body(req: &Request, body: Body) -> S3Result<Self> {
        let limit = match req.extensions().get::<LengthLimit>() {
            Some(lim) => lim.0,
            None => DEFAULT_LENGTH_LIMIT,
            None => {
                // FIXME: unbounded memory allocation
                let bytes = hyper::body::to_bytes(body).await.map_err(S3Error::internal_error)?;
                return Ok(Self(bytes));
            }
        };

        let content_length = req
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ impl S3Service {
        Self {
            s3,
            auth: None,
            full_body_limit: crate::http::DEFAULT_LENGTH_LIMIT,
            full_body_limit: 0,
            base_domain: None,
        }
    }