-
Notifications
You must be signed in to change notification settings - Fork 93
Multipart.foreach_entry() panics on unseen keys, is it expected? #114
Comments
Yes, it's a bug. Every call to |
Is it easy to fix? Perhaps I can try help or you've got time to handle it? I am new to rust and would love some simple tasks to learn more about it :) |
This unfortunately is going to require some debugging. That error is being returned from here: https://github.com/abonander/multipart/blob/master/src/server/field.rs#L77 But the problem isn't with that code. The buffer isn't being emptied so it can't read the headers. The method responsible for emptying the buffer is But what we need is the raw request body that's triggering this behavior. If it doesn't contain any confidential data, do you mind posting it? Otherwise you should be able to replace the contents and strings in the headers with arbitrary bytes as long as the length is the same. |
@abonander I see. Basically I noticed this problem while developing an example code for the tide project: You can see the error by:
Lines to remove to see the error: Let me know if this can help you see the issue on your side. |
So what I need in this context is the request body that Then attach the resulting file to a Github comment so I can inspect it. |
Aha, I see, that one I can do easily, here is the output of --trace:
|
I've added a reproduction test for this issue to the The assert that triggers right now is the one in the |
Interesting. Thanks for trying to solve it @abonander 😄 |
Fix published as |
Hi there
I am trying to use multipart in the project Tide with building an example like in this PR:
http-rs/tide#47
If you read the comments or take a look at the
examples/multipart-form/main.rs
file, you could see I tried to useforeach_entry
method and make the lambda does nothing (only println) on a key that is not specified in the code.It works with multipart payload with specified keys, however it panics if a key is not specified and giving error message like
Unable to iterate multipart?: Custom { kind: InvalidData, error: TooLarge }
Do users are request to at least run explicitly
entry.data.read_to_end()
once in they function passed toforeach_entry()
method? Or is this a buggy behavior that can be fixed?Thank you :)
The text was updated successfully, but these errors were encountered: