From 5114df6b33e92570c9790a5aa0775a8f28731cfe Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Fri, 6 Feb 2004 17:48:54 -0800
Subject: [PATCH] [svn] Respect --ignore-length. Inhibit keep-alive when
 --ignore-length is used.

---
 src/ChangeLog | 5 +++++
 src/http.c    | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index d40523b9..03858dc8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2004-02-06  Hrvoje Niksic  <hniksic@xemacs.org>
+
+	* http.c (gethttp): Respect --ignore-length.
+	(gethttp): Inhibit keep-alive if --ignore-length is specified.
+
 2004-02-06  Hrvoje Niksic  <hniksic@xemacs.org>
 
 	* connect.c (sockaddr_set_data): Zero out
diff --git a/src/http.c b/src/http.c
index b779e36e..86324f08 100644
--- a/src/http.c
+++ b/src/http.c
@@ -1057,7 +1057,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
   int keep_alive;
 
   /* Whether keep-alive should be inhibited. */
-  int inhibit_keep_alive = !opt.http_keep_alive;
+  int inhibit_keep_alive = !opt.http_keep_alive || opt.ignore_length;
 
   /* Headers sent when using POST. */
   long post_data_size = 0;
@@ -1455,7 +1455,8 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
       print_server_response (resp, "  ");
     }
 
-  if (response_header_copy (resp, "Content-Length", hdrval, sizeof (hdrval)))
+  if (!opt.ignore_length
+      && response_header_copy (resp, "Content-Length", hdrval, sizeof (hdrval)))
     contlen = strtol (hdrval, NULL, 10);
 
   /* Check for keep-alive related responses. */