bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] [Bug-Wget] Use of maltipart/form-data when using body-fil


From: Daniel Stenberg
Subject: Re: [Bug-wget] [Bug-Wget] Use of maltipart/form-data when using body-file command
Date: Tue, 16 Apr 2013 00:15:31 +0200 (CEST)
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Sun, 14 Apr 2013, Tim Rühsen wrote:

I wanted to propose that we use Content-Type: multipart/form-data and send the whole file as-is when using the --body-file option. This allows us to add the long missing functionality to send files as attachments through wget, without having to change the working of the old options.

Why not look at curl (see --form) and decide, if it is the optimum or if there is a better way for the user to specify what he wants to upload. And then implement the best option syntax.

I'm the main author of the -F logic for curl so I'm very biased here. But let me just provide some data. (And I don't think --form syntax curl uses is the "optimum" interface, it is just one I made up some 10-12 years ago and we've stayed with it to maintain compatibility - and it works pretty good.)

multipart/form-data posts consis of one or more parts, where most HTML forms use more than one. To allow a tool to mimic a browser fine, you need to be able to fill in the other parts as well as the file upload (and you can even nest the parts, and for example upload multiple files within a single part). Users also occasionally want to alter the headers for specific form parts. (RFC1867 has all the details on the format.)

The boundary string Giuseppe mentioned isn't really such a big deal if you ask me. You can easily make it in the same style as the browsers do it (a --------- prefix and a series of random letters) and if you like curl use 12 random hex letters it still makes 184884258895036416 possible combos.

--

 / daniel.haxx.se

reply via email to

[Prev in Thread] Current Thread [Next in Thread]