Replies: 2 comments 7 replies
-
@HLeithner Excellent question! There's indeed a 64 KiB default limit for the request body when using the built-in web server as covered in the documentation https://framework-x.clue.engineering/docs/api/request/#uploads You're right that this can indeed by configured on the underlying The main reason why this wasn't done yet: The request body will always be kept in memory to avoid any disk I/O. This means that for large request bodies, we could potentially end up storing megabytes or even gigabytes in memory for incoming requests. What do you think about this, I wonder how we could handle this? |
Beta Was this translation helpful? Give feedback.
-
This is an absolute dealbreaker for me - I need to handle quite a lot uploaded files, mainly documents but also user avatars etc. all of which are way bigger than 64KB. Even worse I found out about this limitation only after investing quite a lot time into refactoring the current project to ReactPHP and then lately using Framework X. While being able to increase the limit just like in ReactPHP would definitely help a bit, the memory usage indeed becomes an issue very quickly. My project runs on several (auto-scaling) "Cloudlets" where the smallest instance begins with just 128 MB of RAM. The tiny footprint + impressive performance of the built-in ReactPHP webserver and the resulting tiny Docker images seemed to be a perfect fit... Unfortunately, I don't know enough about the internals and aforementioned limitations of the request parser to propose a solution... I have a feeling that being able to pipe the request body as a stream through a handler/middleware that on detecting the start of a file fires an event where one could handle the file (again, as a stream) and e.g. write/pipe it to disk would be a nice way. |
Beta Was this translation helpful? Give feedback.
-
While I'm trying to overcome the 64KiB limit based on the discussion at reactphp/http#412 I found out that this is not possible with the current Middleware implementation by framework-x.
Framework X bypasses the default ReactPHP
HttpServer
Middleware handling code by creating it's ownMiddlewareHandler
and only pass a closure to theHttpServer
. TheHttpServer
tries to detect theStreamingRequestMiddleware
so it's disabling it's default "Limiting Middlewares", which of course is not possible because only a closure with it's ownMiddlewareHandler
is provided.Any idea how to solve this issue?
Beta Was this translation helpful? Give feedback.
All reactions