rustypaste icon indicating copy to clipboard operation
rustypaste copied to clipboard

Upload limit is ignored

Open tessus opened this issue 1 year ago • 10 comments

I have set max_content_length = "50MB", but whenever I upload a file larger than 50MB, the entire file is uploaded and only then I get the error message that the limit is exceeded.

rpaste

https://github.com/user-attachments/assets/a4c88e80-980b-4614-89dd-a679aca1ab91

curl

https://github.com/user-attachments/assets/b427758e-57b1-4d94-ae15-3e14bc75de44

tessus avatar Aug 18 '24 19:08 tessus

The middleware was implemented in #53 and yes, it turns out it is broken. I just reproduced this issue.

What would be the way of going forward with fixing this? Should we check HEAD requests, or do something in the middleware? Any ideas?

orhun avatar Aug 20 '24 19:08 orhun

What would be the way of going forward with fixing this?

At one point I read a comment (but I am not sure in which repo or issue/discussion) that there is now a native way with the new versions of actix and/or actix-multipart which should render the middleware obsolete.

I've been looking for that comment frantically, but unfortunately haven't found it yet.

tessus avatar Aug 20 '24 20:08 tessus

It would be the best way of moving forward if something like that exists. Custom implementations are not always infallible, like we saw in this case :D

orhun avatar Aug 21 '24 13:08 orhun

I think I found it: https://stackoverflow.com/a/78399675

tessus avatar Aug 21 '24 13:08 tessus

That's superb, can you try it out?

One thing to note that we probably won't be able to change this on the fly since it's configured while the App is constructed.

orhun avatar Aug 21 '24 15:08 orhun

Not sure when I get to it, but yes, I would like to.

tessus avatar Aug 21 '24 16:08 tessus

I tried it, but unfortunately no difference. Maybe there's an issue with the Byte arithmetic. I am quite puzzled by this. When I get to it, I'll open a draft PR and you can have a look at my attempt to make it woek with the "new" way of doing it according to the stackoverflow comment. Maybe I fucked it up though...

tessus avatar Sep 16 '24 20:09 tessus

Yup, shoot me a draft whenever you can!

orhun avatar Sep 24 '24 15:09 orhun

This (#360) was supposed to work, but it doesn't. I am not sure how to solve this. I can't believe nobody ever got this to work.

tessus avatar Oct 25 '24 01:10 tessus

We both seem quite puzzled by this. Maybe a gentle ping to the actix master @robjtede would help us out a bit 😊

orhun avatar Oct 29 '24 08:10 orhun