From 1cf13c825fa9e45a3dc8f7abf5aa43d8446b89ab Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 31 Jul 2000 21:30:19 +0000
Subject: [PATCH] Replacing one of the internal headers with one that has no
 contents will now completely disable that header to get sent.

---
 lib/http.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/lib/http.c b/lib/http.c
index c8be1e35d4..f6b6266062 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -399,9 +399,22 @@ CURLcode http(struct connectdata *conn)
     }
 
     while(headers) {
-      sendf(data->firstsocket, data,
-            "%s\015\012",
-            headers->data);
+      char *ptr = strchr(headers->data, ':');
+      if(ptr) {
+        /* we require a colon for this to be a true header */
+
+        ptr++; /* pass the colon */
+        while(*ptr && isspace(*ptr))
+          ptr++;
+
+        if(*ptr) {
+          /* only send this if the contents was non-blank */
+
+          sendf(data->firstsocket, data,
+                "%s\015\012",
+                headers->data);
+        }
+      }
       headers = headers->next;
     }
 
-- 
GitLab