Merge branch 'master' of github.com:bagder/curl
authormonnerat <pm@datasphere.ch>
Mon, 19 Apr 2010 15:37:51 +0000 (17:37 +0200)
committermonnerat <pm@datasphere.ch>
Mon, 19 Apr 2010 15:37:51 +0000 (17:37 +0200)
CHANGES
RELEASE-NOTES
lib/md5.c
src/main.c

diff --git a/CHANGES b/CHANGES
index dda8a4c..919a3d6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel Stenberg (19 Apr 2010)
+- -J/--remote-header-name didn't strip trailing carriage returns or linefeeds
+  properly, so they could be used in the file name.
+
 Daniel Stenberg (16 Apr 2010)
 - Jerome Vouillon made the GnuTLS SSL handshake phase non-blocking.
 
index 3117bf8..e496826 100644 (file)
@@ -17,6 +17,7 @@ This release includes the following bugfixes:
  o detect GSS on ancient Linux distros
  o GnuTLS: EOF caused error when it wasn't
  o GnuTLS: SSL handshake phase is non-blocking
+ o -J/--remote-header-name strips CRLF
 
 This release includes the following known bugs:
 
index 0908cd8..3f715ba 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -371,13 +371,15 @@ static void Decode (UINT4 *output,
 
 #endif /* USE_GNUTLS */
 
-const HMAC_params Curl_HMAC_MD5[1] = {
-  (HMAC_hinit_func) MD5_Init,           /* Hash initialization function. */
-  (HMAC_hupdate_func) MD5_Update,       /* Hash update function. */
-  (HMAC_hfinal_func) MD5_Final,         /* Hash computation end function. */
-  sizeof(MD5_CTX),                      /* Size of hash context structure. */
-  64,                                   /* Maximum key length. */
-  16                                    /* Result size. */
+const HMAC_params Curl_HMAC_MD5[] = {
+  {
+    (HMAC_hinit_func) MD5_Init,           /* Hash initialization function. */
+    (HMAC_hupdate_func) MD5_Update,       /* Hash update function. */
+    (HMAC_hfinal_func) MD5_Final,         /* Hash computation end function. */
+    sizeof(MD5_CTX),                      /* Size of hash context structure. */
+    64,                                   /* Maximum key length. */
+    16                                    /* Result size. */
+  }
 };
 
 
index 0670b5f..b7e438b 100644 (file)
@@ -4200,9 +4200,26 @@ parse_filename(char *ptr, size_t len)
     }
   }
 
-  q = strrchr(p, quote);
-  if (q)
-    *q = 0;
+  if(quote) {
+    /* if the file name started with a quote, then scan for the end quote and
+       stop there */
+    q = strrchr(p, quote);
+    if (q)
+      *q = 0;
+  }
+  else
+    q = NULL; /* no start quote, so no end has been found */
+
+  if(!q) {
+    /* make sure the file name doesn't end in \r or \n */
+    q = strchr(p, '\r');
+    if(q)
+      *q  = 0;
+
+    q = strchr(p, '\n');
+    if(q)
+      *q  = 0;
+  }
 
   if (copy!=p)
     memmove(copy, p, strlen(p)+1);