Hello,

This patch allows curl to be able to send the custom headers with empty value.
I badly need this function, but now latest curl can not.

If you put a space character after a colon then you can send its header.

curl -v -k -X POST -H 'X-Custom: ' http://to/

If you set no-blank after a colon then curl does not send any headers.
This is current specification, you know?

curl -v -k -X POST -H 'X-Custom:' http://to/

Please marge this to trunk.

==
diff --git a/lib/http.cb/lib/http.c
index 4952ddd..f7913ad 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1526,8 +1526,9 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
while(*ptr && ISSPACE(*ptr))
ptr++;

- if(*ptr) {
+ if(*ptr || ((!strcmp(ptr - 1, " ") && *ptr == '\0'))) {
/* only send this if the contents was non-blank */
+ /* or send this if the contents was a space */

if(conn->allocptr.host &&
/* a Host: header was sent already, don't pass on any custom Host:
diff --git a/tests/libtest/lib553.cb/tests/libtest/lib553.c
index cb1cefd..dfd74fb 100644
--- a/tests/libtest/lib553.c
+++ b/tests/libtest/lib553.c
@@ -83,7 +83,7 @@ int test(char *URL)
headerlist = hl;
}

- hl = curl_slist_append(headerlist, "Expect: ");
+ hl = curl_slist_append(headerlist, "Expect:");
if (!hl)
goto test_cleanup;
headerlist = hl;

==
# make test
:
TESTDONE: 530 tests out of 530 reported OK: 100%
TESTDONE: 629 tests were considered during 217 seconds.


Regards,
Yukihiro KAWADA
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to