]> sjero.net Git - wget/commitdiff
[svn] Fix broken --save-headers.
authorhniksic <devnull@localhost>
Sat, 18 Jun 2005 14:13:16 +0000 (07:13 -0700)
committerhniksic <devnull@localhost>
Sat, 18 Jun 2005 14:13:16 +0000 (07:13 -0700)
src/ChangeLog
src/http.c

index 756178e70cf73755c526058669b309f5dbd57698..2b62712dd335a93a00381e781bb04d1fa68a66d1 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-18  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * http.c (gethttp): Don't free "head" before using it to save
+       headers.
+
 2005-06-18  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * http.c (gethttp): When -E is in use, check for file existence
index 263a26fd630e470ff31480a9fe8052ed5662f955..69760e7a1c3233e55cc6181160d2cc5b662b4766 100644 (file)
@@ -1753,7 +1753,6 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
        contrange = first_byte_pos;
     }
   resp_free (resp);
-  xfree (head);
 
   /* 20x responses are counted among successful by default.  */
   if (H_20X (statcode))
@@ -1946,6 +1945,9 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
   if (opt.save_headers)
     fwrite (head, 1, strlen (head), fp);
 
+  /* Now we no longer need to store the response header. */
+  xfree (head);
+
   /* Download the request body.  */
   flags = 0;
   if (keep_alive)