bug-wget
[Top][All Lists]
Advanced

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

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


From: Darshit Shah
Subject: Re: [Bug-wget] Syntax for RESTful scripting options
Date: Fri, 5 Apr 2013 15:46:26 +0530

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 --post-data / --post-file when invoked with
--method, wget will NOT fallback to GET upon a redirection request.
* Added sanity checks to ensure that wget is not invoked with both,
--body-data and -body-file or that it is not invoked with either of them
but without a --method.
* Added sanity check to ensure that wget is not invoked with method and
--post-file or --post-data
* Added missing sanity check to ensure that wget is not invoked with both
--post-file and --post-data

All the changes have been squashed into one single commit. In case it is
preferred to send them as separate commits, I will do the same.




On Sun, Mar 17, 2013 at 12:45 PM, Darshit Shah <address@hidden> wrote:

> 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.
>
> These two are the same functionality, why not merge it internally. Only
> issue is, how to do it efficiently?
>
> I am unable to understand who to set two flags through setoptval() for a
> given command without putting an if condition in there.
>
>
> On Sun, Mar 17, 2013 at 2:04 AM, Giuseppe Scrivano <address@hidden>wrote:
>
>> Hi Darshit,
>>
>> Darshit Shah <address@hidden> 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 that executes the old --post-data and
>> --post-file commands.
>>
>> great work!  Just some comments:
>>
>>
>> +    else if (opt.method)
>> +      {
>> +        char *q;
>> +        int s = strlen (opt.method);
>> +        for ( q = opt.method; s>=0; ++q, s-- )
>> +          *q = c_toupper (*q);
>> +        meth = opt.method;
>> +      }
>>
>> this could be simplified as:
>>
>> for (q = opt.method; *q; ++q)
>>
>> then you don't need s at all.
>>
>> The new flags should be documented, could you add also the documentation
>> for those?
>>
>> Cheers,
>> Giuseppe
>>
>
>
>
> --
> Thanking You,
> Darshit Shah
> Research Lead, Code Innovation
> Kill Code Phobia.
> B.E.(Hons.) Mechanical Engineering, '14. BITS-Pilani
>



-- 
Thanking You,
Darshit Shah
Research Lead, Code Innovation
Kill Code Phobia.
B.E.(Hons.) Mechanical Engineering, '14. BITS-Pilani

Attachment: 0001-Add-a-method-command-to-set-a-Method-to-use-in-the-H.patch
Description: Binary data


reply via email to

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