On 01.12.19 12:48, Taylor wrote: > Huge POST requests with WGET & "multipart/form-data" > ---------------------------------------------------- > > Hello > > I have been using WGET for many years and appreciate it. > Unfortunately I recently ran into trouble due to changed > behaviour of some servers. Some POST requests started to > fail silently with error code 4. No error or rejection > message is showed. Even "-d" does not bring up any useful > hints. The thing simply aborts the communication after having > tried to send the POST-data. Finally I figured out that the > server apparently started rejecting POST-data if it is > bigger than 8 KiO and expects "multipart/form-data" instead. > > RTFM: > >> In particular, they both expect content of the form >> key1=value1&key2=value2, with percent-encoding for special characters; >> the only difference is that one expects its content as a command-line >> parameter and the other accepts its content from a file. In particular, >> "--post-file" is not for transmitting files as form attachments: >> those must appear as key=value data (with appropriate percent-coding) >> just like everything else. Wget does not currently support >> multipart/form-data for transmitting POST data; only >> application/x-www-form-urlencoded. > ... >> Currently, "--body-file" is not for transmitting files as a whole. >> Wget does not currently support multipart/form-data for transmitting >> data; only application/x-www-form-urlencoded. In the future, this may >> be changed so that wget sends the "--body-file" as a complete file >> instead of sending its contents to the server. > > I am less smart than I would like to be after having read this, > especially the statement "sends the "--body-file" as a complete > file instead of sending its contents" is incomprehensible to me. > > How can I send huge POST requests via "multipart/form-data" now ? > > * Can this be workarounded with existing WGET versions (prepare > data manually and use "--body-file" to send "raw" data) ?
You can, see second answer at https://duckduckgo.com/?q=wget+to+upload+data&t=ffab. But indeed, as Daniel says, curl's support for form-data is much better. Curl does the form-data encoding for you while for wget you have to do it manually. > * Is there a chance that WGET will support "multipart/form-data" > soon (apparently this has been on the wishlist for a long time) ? Planned for Wget2. Regards, Tim
signature.asc
Description: OpenPGP digital signature