Hi Sergey, a minor nitpick inline below.
On 5/9/22 11:59 PM, Sergey Ponomarev wrote: > You can add a custom HTTP header(s) to request: > > wget --header='Authorization: Bearer TOKEN' \ > --header='If-Modified-Since: Wed, 9 May 2021 12:16:00 GMT' \ > https://example.com/ > > Some headers like Authorization or User-Agent may be already set by > --password or --user-agent. > We may override them but it's a protection from user itself. > To keep code concise the logic omitted. > > Signed-off-by: Sergey Ponomarev <[email protected]> > --- > [...] > + case L_HEADER: > + if (!raw_headers) { > + /* Max possible count of headers is the > count of args (argc) - 2 > + Since the first arg is program and > last is a URL. > + But user may forget the URL and > raw_headers is null terminated so allocate argc */ > + raw_headers = calloc(argc, sizeof(char > *)); Please handle a possible calloc() error here. Maybe consider introducing an "xalloc()" or similar helper which wraps calloc() and invokes abort() on NULL return. > + } > + raw_headers[raw_headers_count] = optarg; > + raw_headers_count++; > + break; > case L_POST_DATA: > post_data = optarg; > break; > [...]
signature.asc
Description: OpenPGP digital signature
_______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
