Re: --post-data encoding

2007-09-03 Thread Hrvoje Niksic
"control H" <[EMAIL PROTECTED]> writes:

> After a few hours of headache I found out my --post-data option
> didn't work as I expected because the data I send has to be
> URL-escaped. This is not mentioned both in the manpage and inline
> help. A remark would be helpful.

Note that, in general, it doesn't.  POST requests are a generic
mechanism for transferring data, and a valid POST request can contain
an (unencoded) XML document or even binary data in its body.  URL
encoding is only necessary when transferring HTML form data from a
client to the server.  Wget doesn't assume that this is the case --
the POST options are designed as a low-level tool which the user is
expected to understand how to use.

I now see that this is not the most useful design for most people; for
one, the manual could at least document the typical usage.  It is also
inconsistent because Wget automatically sends "Content-Type:
application/x-www-form-urlencoded" when one of the POST options is in
use, which indicates that the primary usage for POST was uploading
form data.

One way to solve this is to introduce higher-level functionality, such
as --form-data and --form-attach (for uploading files) which construct
a POST request suitable for sending form data, so the user doesn't
have to.  In that case --post-data and --post-file would no longer
need to set content-type to application/x-www-form-urlencoded.


--post-data encoding

2007-09-03 Thread control H
Hi,

I'm not sure wether I'm experiencing a bug or not, so just to let you know.

After a few hours of headache I found out my --post-data option didn't
work as I expected because the data I send has to be URL-escaped. This
is not mentioned both in the manpage and inline help. A remark would
be helpful.

Since I don't know what should be expected behaviour I can't decide
wether this satisfies the bug criteria. As you have guessed by now, I
would mark this as a bug. There's not much use in URL-escaping data
yourself. Or maybe it could be an extra option to specify if your
suplied data is to be URL encoded or not. A quick search in the
bugarchive about this subject didn't yield any results.

Tested versions:
1.10.2 (Red Hat modified)
But I know for sure older version act the same. In fact, I guess all
versions act the same.

Regards,
CH