Re: [Bug-wget] Syntax for RESTful scripting options

2013-04-12 Thread Darshit Shah
There we go. Attaching the next iteration of the patch to add more REStful scripting options. Changes included are: * Accept an option during invocation, called --method=MethodString. The MethodString will be converted to Uppercase and sent as the Method. * The old --post-data and --post-file

Re: [Bug-wget] Syntax for RESTful scripting options

2013-04-07 Thread Darshit Shah
As expected, explicitly setting opt.method = POST results in a Segmentation Fault if the server sends a redirect response. This will occur because, when processing the new url, both opt.method and opt.post-data / opt.post_file_name are set. The only sane way of making post-data / post-file ride on

Re: [Bug-wget] Syntax for RESTful scripting options

2013-04-05 Thread Darshit Shah
Attaching a patch file for the inclusion of a generic --method command to send other HTTP Methods through wget. Changes included are: * Accept an option during invocation, called --method=MethodString. The MethodString will be converted to Uppercase and sent as the Method. * Unlike the case with

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-17 Thread Darshit Shah
Thanks! I'll incorporate that advice in my code. Also, I have the documentation ready in a separate branch. Will merge and submit a final patch. However, I would really like to remove the redundant code I have created by testing for body_data || body_file and post_data || post_file separately.

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-16 Thread Giuseppe Scrivano
Hi Darshit, Darshit Shah dar...@gmail.com writes: I have implemented a --method command along with --body-data and --body-file commands for HTTP Scripting. Have attached the patch alongwith this mail. However, this is not complete, not to my satisfaction atleast. There is redundant code

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-15 Thread Darshit Shah
I have implemented a --method command along with --body-data and --body-file commands for HTTP Scripting. Have attached the patch alongwith this mail. However, this is not complete, not to my satisfaction atleast. There is redundant code that executes the old --post-data and --post-file commands.

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-11 Thread Darshit Shah
please don't add these. I don't think we would like to add a new pair of --FOO-data, --FOO-file for any method we will implement. As already suggested by Hrvoje, just add --body-data and --body-file that are synonyms for --post-data and --post-file; we can't drop these for backward

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-11 Thread Giuseppe Scrivano
Darshit Shah dar...@gmail.com writes: please don't add these. I don't think we would like to add a new pair of --FOO-data, --FOO-file for any method we will implement. As already suggested by Hrvoje, just add --body-data and --body-file that are synonyms for

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-11 Thread Giuseppe Scrivano
Darshit Shah dar...@gmail.com writes: Reusing post-data and post-file is not intuitive enough when we support more options through --method. Say, someone wished to use --method=PUT. In that case using --post-data or --post-file is counter intuitive. Hence the need to unify them

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-11 Thread Darshit Shah
Also, alongwith implementing --body-data and --body-file should I mark the --post-data and --post-file commands as deprecated? Or is there a different protocol to follow before marking a command as deprecated? On Mon, Mar 11, 2013 at 7:38 PM, Darshit Shah dar...@gmail.com wrote: None. Fine,

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-11 Thread Giuseppe Scrivano
Darshit Shah dar...@gmail.com writes: Also, alongwith implementing --body-data and --body-file should I mark the --post-data and --post-file commands as deprecated? Or is there a different protocol to follow before marking a command as deprecated? I don't see any real value to mark

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-09 Thread Hrvoje Niksic
Darshit Shah dar...@gmail.com writes: Okay gathering inputs from all the replies above., I think the best way to move forward would be to implement a --method=GET|POST|PUT|DELETE followed by --post-data or --post-file in case of POST and --put-data --put-file in case of the PUT option. Since

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-09 Thread Tony Lewis
Hrvoje Niksic wrote: Another possibility would be to add some more syntax to --method so as to allow --method=POST:file=foo, and also --method=PUT:data=abc Since '=' is a valid (and frequent) delimiter for what follows data= perhaps another pair of delimiters would be better. How about

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-08 Thread Ángel González
On 08/03/13 19:18, Darshit Shah wrote: Okay gathering inputs from all the replies above., I think the best way to move forward would be to implement a --method=GET|POST|PUT|DELETE followed by --post-data or --post-file in case of POST and --put-data --put-file in case of the PUT option. In

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-08 Thread Tim Rühsen
Am Dienstag, 5. März 2013 schrieb Darshit Shah: Need some help with writing a test for this functionality. I have implemented a --method=HHTPMethod command that currently supports DELETE only. I would be very grateful if someone can help me with writing a test to ensure that this is working

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-08 Thread Ángel González
On 07/03/13 05:37, Steven M. Schweda wrote: wget --options=POST `cat POSTdata` URL Why not go with that? Apparently always means something to you which is different from what it means to me. It may be hard to believe, or you may not care, but some folks use this program on

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-07 Thread Tim Ruehsen
Am Thursday 07 March 2013 schrieb Darshit Shah: Okay, these are certain points that do not come instantly to me. However, I never intended to break these. The above functionality would remain for backward compatibility with old scripts. I am simply debating on how to implement this as a new

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-07 Thread Hrvoje Niksic
Tim Ruehsen tim.rueh...@gmx.de writes: BTW: How can Wget create a POST without any data (without Content-Type and Content- Length) ? Curl can... If by without any data you mean with empty POST data, use `--post-data='. But that will send 0 Content-Length and the usual Content-Type. As

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Darshit Shah
Taking this forward. I figured it would be best to merge --post-data and --post-file commands into --method=HTTPMethod I intend to use the following logic in merging them: wget --method=POST [data/file] URL The text immediately following --method=POST is first assumed to be data. If however it

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Daniel Stenberg
On Wed, 6 Mar 2013, Darshit Shah wrote: I intend to use the following logic in merging them: wget --method=POST [data/file] URL The text immediately following --method=POST is first assumed to be data. If however it does not exist in the key:value format, assume that to be a file path and

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Daniel Stenberg
On Thu, 7 Mar 2013, Darshit Shah wrote: The only reason I said that is, even currently wget only accepts post data in a key=value format.* Oh wow. I guess it proves I never use this feature with wget - no big surprise there probably. But I consider that to be a terrible limitation as well,

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Darshit Shah
The only reason I said that is, even currently wget only accepts post data in a key=value format.* *sorry it's not key:value but key=value. On Mar 7, 2013 12:12 AM, Daniel Stenberg dan...@haxx.se wrote: On Wed, 6 Mar 2013, Darshit Shah wrote: I intend to use the following logic in merging

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Giuseppe Scrivano
Darshit Shah dar...@gmail.com writes: Taking this forward. I figured it would be best to merge --post-data and --post-file commands into --method=HTTPMethod I intend to use the following logic in merging them: wget --method=POST [data/file] URL If a method (like OPTIONS) includes an

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Hrvoje Niksic
Daniel Stenberg dan...@haxx.se writes: On Thu, 7 Mar 2013, Darshit Shah wrote: The only reason I said that is, even currently wget only accepts post data in a key=value format.* Oh wow. The above claim is patently false. Wget doesn't care about the format of --post-data or the contents of

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Darshit Shah
Okay, I just checked. The man page clearly states: In particular, they *both *expect content of the form key1=value1key2=value2 However, in a practical use case, wget performs no such checks and will send any data you provide it with. So then how to unify --post-data and --post-file into

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Steven M. Schweda
Also, is the --post-file command really needed? Even if one does really need to use POST data from a file, one could always cat the file inside backticks as: wget --options=POST `cat POSTdata` URL Why not go with that? Apparently always means something to you which is different

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Darshit Shah
Okay, these are certain points that do not come instantly to me. However, I never intended to break these. The above functionality would remain for backward compatibility with old scripts. I am simply debating on how to implement this as a new feature. On Thu, Mar 7, 2013 at 10:07 AM, Steven M.

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-06 Thread Hrvoje Niksic
Darshit Shah dar...@gmail.com writes: Okay, I just checked. The man page clearly states: In particular, they *both *expect content of the form key1=value1key2=value2 Good point. The man page should be changed make it clear that it's the *server* that expects such post data when processing

[Bug-wget] Syntax for RESTful scripting options

2013-03-05 Thread Darshit Shah
I was addressing this feature request: https://savannah.gnu.org/bugs/?37055 Which asks for an option to include the DELETE method in wget for RESTful scripting. Would the following syntax be the right way one would want to execute such a command? wget --delete URL pointing to resource that must

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-05 Thread Ángel González
On 05/03/13 10:41, Darshit Shah wrote: I was addressing this feature request: https://savannah.gnu.org/bugs/?37055 Which asks for an option to include the DELETE method in wget for RESTful scripting. Would the following syntax be the right way one would want to execute such a command?

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-05 Thread Daniel Stenberg
On Tue, 5 Mar 2013, Ángel González wrote: wget --delete URL pointing to resource that must be deleted I would prefer something like --method=delete, which would also allow other methods (eg. OPTIONS, TRACE, PROPFIND...) Which incidentally is how curl does it (just with a differently named

Re: [Bug-wget] Syntax for RESTful scripting options

2013-03-05 Thread Giuseppe Scrivano
Daniel Stenberg dan...@haxx.se writes: On Tue, 5 Mar 2013, Ángel González wrote: wget --delete URL pointing to resource that must be deleted I would prefer something like --method=delete, which would also allow other methods (eg. OPTIONS, TRACE, PROPFIND...) Which incidentally is how curl