GetHTTPRequestData(): uses memory reading request body every time it is called

Description

Every time GetHTTPRequestData() is called (without setting includeBody=false), the request body is read into memory.

If you upload a large file, for example, and happen to call getHttpRequestData() in lots of places, this causes an additional and considerable burden on the request memory footprint.

Suggestion: if possible, only parse the body the first time it is requested. Subsequent calls can then just refer to this by reference.

Activity

Show:

Dominic Watson 9 January 2023 at 09:09
Edited

According to FusionReactor, the “Memory used” by the request increases each time you make a call to getHttpRequestData(). i.e. by a lot if you’re uploading files. Perhaps this is a bug with FusionReactor, not sure.

Brad Wood 8 December 2020 at 19:07

I'm confused by this as the Java servlet spec already only allows the request body to be read once:
https://docs.oracle.com/javaee/7/api/javax/servlet/ServletRequest.html#getInputStream--
Lucee employs a servlet request wrapper that reads the request body once and caches it. What exactly are you seeing that is bring "read" more than once?

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Priority

Created 6 December 2020 at 22:26
Updated 9 January 2023 at 11:00