Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100MB limit raising in actix-multipart example code is ignored #3549

Open
ssokolow opened this issue Jan 10, 2025 · 3 comments · May be fixed by #3567
Open

100MB limit raising in actix-multipart example code is ignored #3549

ssokolow opened this issue Jan 10, 2025 · 3 comments · May be fixed by #3567

Comments

@ssokolow
Copy link

Expected Behavior

53.1MB test file should be accepted as an upload by the example with a 100MB limit, like the 8MB test file was and like it was when using the FromRequest example code from actix_multipart::Multipart with a suitably high global limit.

Current Behavior

If testing using curl, Payload error is returned.

When logging is plumbed in, DEBUG Error in response: Payload(Overflow) is the result.

Also using MultipartFormConfig to attempt to raise the limit, as "Note: the form is also subject to the global limits configured using MultipartFormConfig." seems to indicate to be necessary, has no effect.

Possible Solution

Make it work as described.

Steps to Reproduce (for bugs)

  1. cargo new actix-test && cd actix-test && cargo add actix-web actix-multipart && cargo add serde --features derive
  2. Copy the example code into a new project's src/main.rs
  3. cargo run
  4. curl -v --request POST --url http://localhost:8080/videos -F 'json={"name": "Cargo.lock"};type=application/json' -F file=@./some_file_over_50_megs

Context

If this isn't fixed, I have to NIH the exact same functionality on top of actix_multipart::Multipart to achieve my goals.

Your Environment

  • Rust Version (I.e, output of rustc -V): rustc 1.83.0 (90b35a623 2024-11-26)
  • Actix Web Version: 4.9.0
  • actix-multipart Version: 0.7.2
@feliwir
Copy link

feliwir commented Feb 3, 2025

Also getting a similar issue, but not sure if this is related to the Payload inside the struct or some other issue:

Image

The limit is defined is 1000MB, however i only uploaded 105 MB of files

@MMitsuha
Copy link

MMitsuha commented Feb 5, 2025

Copy the example code into a new project's src/main.rs

It seems that the multipart has a total limit of 50 MiB (hardcoded here) and in memory limit of 2 MiB by default. Try increasing them together.

@ebissi
Copy link

ebissi commented Feb 5, 2025

Possible Solution

Make it work as described.

To correct the example we need to configure the extractor to accept forms up to 100MB when creating the App:

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(move || App::new().service(post_video).app_data(MultipartFormConfig::default().total_limit(100 * 1024 * 1024)))
        .bind(("127.0.0.1", 8080))?
        .run()
        .await
}

Here it worked as intended.

@MMitsuha MMitsuha linked a pull request Feb 5, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants