magiclen / rocket-multipart-form-data

This crate provides a multipart parser for the Rocket framework.
MIT License
35 stars 14 forks source link

Question : Setting form size limit #10

Closed makiwara-fr closed 3 years ago

makiwara-fr commented 3 years ago

I cannot find ways to set a size limit to the form data.

I've try through rocket.toml forms limit without success Any way to do it ?

Thanks

magiclen commented 3 years ago

To make it clear, this crate is for multipart-form-data, not for x-www-form-urlencoded which is already implemented in the Rocket framework itself.

You probably wrote something like

limits = {forms = 32768}

in your Rocket.toml file. That limitation is for x-www-form-urlencoded.

To get back to your question, for this crate, you can set a form size limit on each form field by using the size_limit method of a MultipartFormDataField. Just see the example in README.md.

makiwara-fr commented 3 years ago

Thanks !

indeed I tried limits = {forms = 32768}

Thinking it would inherit from rocket. I will set it programmatically then. Thanks for the heads up