gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnurl] 233/256: http: add custom empty headers to repeated


From: gnunet
Subject: [GNUnet-SVN] [gnurl] 233/256: http: add custom empty headers to repeated requests
Date: Fri, 06 Oct 2017 19:45:24 +0200

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnurl.

commit eac324f28420871b79790c8f2c3a3ec9bd0b9e00
Author: Michael Kaufmann <address@hidden>
AuthorDate: Sun Sep 24 19:31:43 2017 +0200

    http: add custom empty headers to repeated requests
    
    Closes #1920
---
 lib/http.c       |  8 ++++++--
 tests/data/test4 | 10 +++++++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/http.c b/lib/http.c
index ea3e8af35..38227eb6c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1626,12 +1626,12 @@ CURLcode Curl_add_custom_headers(struct connectdata 
*conn,
           else if(conn->bits.authneg &&
                   /* while doing auth neg, don't allow the custom length since
                      we will force length zero then */
-                  checkprefix("Content-Length", headers->data))
+                  checkprefix("Content-Length:", headers->data))
             ;
           else if(conn->allocptr.te &&
                   /* when asking for Transfer-Encoding, don't pass on a custom
                      Connection: */
-                  checkprefix("Connection", headers->data))
+                  checkprefix("Connection:", headers->data))
             ;
           else if((conn->httpversion == 20) &&
                   checkprefix("Transfer-Encoding:", headers->data))
@@ -1664,6 +1664,10 @@ CURLcode Curl_add_custom_headers(struct connectdata 
*conn,
               *ptr = ':';
               result = Curl_add_bufferf(req_buffer, "%s\r\n",
                                         headers->data);
+
+              /* restore the previous value */
+              *ptr = ';';
+
               if(result)
                 return result;
             }
diff --git a/tests/data/test4 b/tests/data/test4
index df69d3274..542347db5 100644
--- a/tests/data/test4
+++ b/tests/data/test4
@@ -30,7 +30,7 @@ http
 Replaced internal and added custom HTTP headers
  </name>
  <command>
- -H "extra-header: here" -H "Accept: replaced" -H "X-Custom-Header;" -H 
"X-Test: foo; " -H "X-Test:" -H "X-Test2: foo;" -H "X-Test3:  " -H "X-Test4;  " 
-H "X-Test5;ignored" http://%HOSTIP:%HTTPPORT/4
+ -H "extra-header: here" -H "Accept: replaced" -H "X-Custom-Header;" -H 
"X-Test: foo; " -H "X-Test:" -H "X-Test2: foo;" -H "X-Test3:  " -H "X-Test4;  " 
-H "X-Test5;ignored" http://%HOSTIP:%HTTPPORT/4 http://%HOSTIP:%HTTPPORT/4
 </command>
 </client>
 
@@ -49,6 +49,14 @@ X-Custom-Header:
 X-Test: foo; 
 X-Test2: foo;
 
+GET /4 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+extra-header: here
+Accept: replaced
+X-Custom-Header:
+X-Test: foo; 
+X-Test2: foo;
+
 </protocol>
 </verify>
 </testcase>

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]