cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] allows curl to be able to send the custom headers with empty value.

From: warp kawada <warp.kawada_at_gmail.com>
Date: Tue, 6 Sep 2011 11:47:43 +0900

I've modified my codes.
How about this?
This patch file is attached.

diff --git a/lib/http.c b/lib/http.c
index b673296..a312c61 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1559,6 +1559,27 @@ CURLcode Curl_add_custom_headers(struct
connectdata *conn,
         }
       }
     }
+ ptr = strchr(headers->data, ';');
+ if(ptr) {
+
+ ptr++; /* pass the semicolon */
+ while(*ptr && ISSPACE(*ptr))
+ ptr++;
+
+ if(*ptr) {
+ /* this may be used for something else in the future */
+ }
+ else {
+ if (*(--ptr) == ';') {
+ /* send no-value custom header if terminated by semicolon */
+ *ptr = ':';
+ result = Curl_add_bufferf(req_buffer, "%s\r\n",
+ headers->data);
+ if(result)
+ return result;
+ }
+ }
+ }
     headers = headers->next;

2011/9/6 Dan Fandrich <dan_at_coneharvesters.com>:
> Since the second form doesn't really even make much sense to use to trigger
> header data removal, and since it could be used for something else in the
> future, my suggestion is to trigger header data removal only if the
> semicolon comes at the end of the string, i.e. the first form above.

Regards,
Thank you.

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

Received on 2011-09-06