-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to send requests "multipart/form-data" that contains files #332
Comments
@Timbuktu1982 nice catch, I have fixed this issue and will publish in next release. |
@Timbuktu1982 you can try the latest version to verify |
@Huachao : Many thanks for the quick help! |
@Huachao I think this issue may have regressed. v0.23.1 of REST Client Fails:
my-file.png is in the same directory as the script file. Content-Length submitted to the server correctly reflects this (hence the file has been located and can be read), however the file is never transmitted/it hangs forever (with the "Waiting" in the bar. Removing the file component of the form results in the request completing quickly (37ms). I've tried with various file types, Content-Types and positions within the multipart form. None work. |
@Ashthos I can't repro this. Could you please check your server side? Or try to downgrade to the old versions. |
Hi @Huachao, My humble apologies, it was an error in my request composition that was causing the problem. I'll document it here so that others hopefully do not fall into the same trap. The RFC on multipart/form (https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html) states the BNF form of the boundary to be: boundary := 0*69 bcharsnospace In my example above, I had the same boundary and delimiter values (i.e. delimiter should have an additional -- before it). A working request: (Note the
But a thing of note is that if the request boundaries are wrong the request never completes, it just sits there 'working' forever (or until you cancel it). |
Error description:
If a request with the content-type "multipart/form-data" containing a file is to be executed, the request continues endlessly and must be aborted with ctrl+alt+k. If no file is transmitted or could not be found, e.g. because the specified file name is not correct, the request works. With file, the request does not work or continues indefinitely without an error message.
Steps to Reproduce:
POST https://www.xxx.de/api/v1/xxxxx HTTP/1.1
Authorization: Bearer XXXXXXXXXXXXXXX
Content-Type: multipart/form-data; boundary=----HereGoes
------HereGoes
Content-Disposition: form-data; name="text"
Content-Type: text/plain
TEXT
TEXT
TEXT
------HereGoes
Content-Disposition: form-data; name="test"; filename="test.png"
Content-Type: image/png
< test.png
------HereGoes--
The text was updated successfully, but these errors were encountered: