curl-library
Re: [PATCH] allows curl to be able to send the custom headers with empty value.
Date: Fri, 2 Sep 2011 11:00:35 -0700
On Thu, Sep 01, 2011 at 05:07:43PM +0900, warp kawada wrote:
> I attach patch file no-value-header.patch to this mail.
> My modifications is below.
>
> # modified: docs/curl.1
> # modified: lib/http.c
> # modified: tests/data/Makefile.am
> # modified: tests/libtest/Makefile.inc
> #
> # newfile: tests/data/test587
> # newfile: tests/libtest/lib587.c
There's no need to create a <tool> test for this, and the associated
increased size, space and compile time hits. A test based on test4
should be perfectly adequate.
> +its header must terminate by semicolon. in: -H "X-Custom-Header;" is to send
> +"X-Custom-Header:".
This would be more clear as:
its header must be terminated with a semicolon, such as \-H "X-Custom-Header;" to send
"X-Custom-Header:".
> + else {
> + bool i = TRUE;
> + ptr = headers->data;
> + while(*ptr) {
> + if (ISSPACE(*ptr++)) {
> + i = FALSE;
> + break;
> + }
Why not use strchr(ptr, ' ') here?
> + }
> + if(i) {
> + ptr = strchr(headers->data, ';');
> + /* send non-value custom header if terminated by semicolon */
> + if (ptr) {
This will eliminate the header when the semicolon doesn't terminate the line,
such as if someone accidentally used a semicolon instead of a colon. This
isn't necessarily bad, but that could be a case that may be useful to use for
for further extensions in the future. I suggest only allowing terminating
semicolons for now.
>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-02