curl-users
Re: [PATH] --data-urlencode
Date: Tue, 20 Nov 2007 18:16:02 +0100
Daniel Stenberg wrote:
> On Mon, 19 Nov 2007, jon_at_linertia.com wrote:
>
>> I think it's an excellent idea. For me, at least, I go to some
>> website that converts it for me, but this would do the job.
>
> Cool! I've committed the patch now, together with a man page update
I've had a look and I like it. name_at_file builds huge stuff I'd
never would have thought to urlencode (yes, multipart/form-data
is more convenient for passing long files, but that's not the
client choice.)
About the man page, I'd replace "Note that the name part is not
encoded" with something like "Note that the name part is expected
to be already urlencoded."
The syntax you proposed covers the vast majority of cases, where
the name does not need encoding. It is cumbersome to handle cases
where the name contains, e.g., %3D, so not all cases can be handled.
And, IMHO, scripts are clearer if special names are manually encoded.
However, the only way I've been able to view the encoded data is by
using -Gv or --trace options. It would be handy to know how to encode
a complicated name before resorting to an external website: Accepting
file://- urls for output? The horrible-patch I attach is just an idea,
please don't take it literally...
Index: main.c
===================================================================
RCS file: /cvsroot/curl/curl/src/main.c,v
retrieving revision 1.431
diff -u -r1.431 main.c
--- main.c 20 Nov 2007 10:08:43 -0000 1.431
+++ main.c 20 Nov 2007 17:00:00 -0000
@@ -3755,8 +3755,11 @@
retry_sleep = retry_sleep_default;
if((!config->url_list || !config->url_list->url) && !config->list_engines) {
+ if(!config->postfields)
+ helpf("no URL specified!\n");
+ else
+ helpf("no URL to post \"%s\"!\n", config->postfields);
clean_getout(config);
- helpf("no URL specified!\n");
return CURLE_FAILED_INIT;
}
if(NULL == config->useragent) {
Received on 2007-11-20