vibe.d throws HTTPServerErrorInfo if a file upload is too large before any of my code executes

Steven Schveighoffer schveiguy at gmail.com
Sun Mar 14 21:24:55 UTC 2021


On 3/14/21 4:55 PM, Chris Bare wrote:
> On Saturday, 13 March 2021 at 21:22:05 UTC, Steven Schveighoffer wrote:
> 
> I don't want to change the size limit.

Well, I'm not sure what you expect then.

> 
>> I would think that the error should be handled fine by vibe-d. Note, 
>> you can override error handling to put out a page of your choice based 
>> on the exception.
> 
> It does return my custom error page, but that is not what I want to return.
> at that point I have no session so I can't send back the page with the 
> form that was submitted marked with an error.

Hm... looks like it's failing before establishing the session. It's 
doing it based on the Content-Length.

The only way I can imagine to make it work without changing vibe-d is to 
set the max size to -1, and then handle it manually in your code.

Technically, the fact that the request is too large is really an 
anti-denial-of-service measure, and arguably you could say that you 
shouldn't look at any requests bigger than your maximum size. To draw a 
comparison, php will actually not send ANYTHING back if the max request 
size is exceeded.

Possibly you could file an enhancement request on vibe-d to still 
process the session even if the request size is too big.

-Steve


More information about the Digitalmars-d mailing list