Skip to content

Handle large octet-stream (master branch) #9440

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

Merged
merged 6 commits into from
Apr 11, 2024
Merged

Conversation

nathannau
Copy link
Contributor

Issue

In scenarios where the request body size exceeds the available RAM, the ESP fails to allocate sufficient memory to process the request in one go.

Change

Now, when the "Content-Type" of the request is "application/octet-stream", it will attempt to call the "ufn" function of the handler, similar to how it handles multipart requests.

Code Example:

server.on(uri, HTTP_PUT, finalCallback, [](){
  HTTPRaw raw = server.raw();
  if (raw.status == RAW_START) {
    ...
  } else if (raw.status == RAW_WRITE) {
    ...
  } else if (raw.status == RAW_END) {
    ...
  }
});

Copy link
Contributor

github-actions bot commented Mar 31, 2024

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Add exemple Upload Huge File":
    • summary looks empty
    • type/action looks empty
  • the commit message "Create .skip.esp32h2":
    • summary looks empty
    • type/action looks empty
  • the commit message "Fix upload path":
    • summary looks empty
    • type/action looks empty
  • the commit message "Handle large octet-stream":
    • summary looks empty
    • type/action looks empty
  • the commit message "Remove unuse function printDirectory":
    • summary looks empty
    • type/action looks empty
  • the commit message "Simplify and generalize the body parsing.":
    • summary should not end with a period (full stop)
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 20 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️ Please consider squashing your 6 commits (simplifying branch history).

👋 Hello nathannau, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 23493b8

@lucasssvaz lucasssvaz self-requested a review April 1, 2024 13:51
@nathannau nathannau force-pushed the master branch 2 times, most recently from 9cae991 to b29efc4 Compare April 1, 2024 22:07
@lucasssvaz
Copy link
Collaborator

@nathannau Please pull the commits and don't force push over them. I had already fixed the CI errors for the example.

@lucasssvaz
Copy link
Collaborator

Following the instruction on the readme causes the error curl: (55) Send failure: Broken pipe.

Copy link
Collaborator

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example doesn't work as expected: curl: (55) Send failure: Broken pipe

@me-no-dev
Copy link
Member

in the example folder you need to add an empty file with name .skip.esp32h2

Copy link
Collaborator

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an empty .skip.esp32h2 file alongside your example

Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected, tested also SDWebServer example with no issues.
@nathannau Please add the skip file for H2. Thanks

@me-no-dev me-no-dev merged commit 93448d7 into espressif:master Apr 11, 2024
39 checks passed
P-R-O-C-H-Y pushed a commit to P-R-O-C-H-Y/arduino-esp32 that referenced this pull request Apr 16, 2024
* Handle large octet-stream

* Add exemple Upload Huge File

* Remove unuse function printDirectory

* Fix upload path

* Simplify and generalize the body parsing.

* Create .skip.esp32h2

---------

Co-authored-by: me-no-dev <[email protected]>
earlephilhower added a commit to earlephilhower/arduino-pico that referenced this pull request May 30, 2024
earlephilhower added a commit to earlephilhower/arduino-pico that referenced this pull request May 30, 2024
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 this pull request may close these issues.

4 participants