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

Chris Bare chris at bareflix.com
Sat Mar 13 20:53:02 UTC 2021


I'm using vibe-d-0.9.3. I have file uploads working fine, but if 
the file it too large, it triggers this:
enforceBadRequest(settings.maxRequestSize <= 0 || contentLength 
<= settings.maxRequestSize, "Request size too big");

inside the handleRequest function, long before my handler 
function is called.

This prevents me from returning a useful error. Vibe sends a 400 
error page:

<!DOCTYPE html>
<html>
	<head>
		<title>Error</title>
	</head>
	<body>
		<h1>Error Happened</h1><p>400</p><p></p><p>Request size too 
big</p><p>Request size too 
big</p><p>/home/chris/.dub/packages/vibe-d-0.9.3/vibe-d/http/vibe/http/server.d:2237</p>
	</body>
</html>

Does anyone have a solution for this?
I guess I could catch the error in my main function, but I 
wouldn't know the context.
Also, since Errors are not intended to be caught, shouldn't this 
be an Exception instead?


More information about the Digitalmars-d mailing list