cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl duplicating "Host:" Header on Keep-Alive Retry: Bug?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 11 Jan 2005 00:42:28 +0100 (CET)

On Mon, 10 Jan 2005, Cyrill Osterwalder wrote:

> I'm that familiar with the sources to submit code suggestions for curl. I
> guess that curl should treat a failed keep-alive request differently from a
> redirect follow request. It should actually resend the same request again on
> a fresh socket without any other changes.

I agree with this, but the reason it uses the redirect method is that it was
an already established method of doing almost exactly what we needed when I
wrote the retry-the-request logic.

This problem you've identified is so far the only downside with this approach.
This situation is also very hard to write a test case/server for...

What about this very simple fix? Won't it suffice?

--- lib/http.c 16 Dec 2004 13:55:19 -0000 1.258
+++ lib/http.c 10 Jan 2005 23:40:48 -0000
@@ -1489,7 +1489,7 @@

      conn->allocptr.host = NULL;
    }
- else {
+ else if(!ptr) {
      /* When building Host: headers, we must put the host name within
         [brackets] if the host name is a plain IPv6-address. RFC2732-style. */

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2005-01-11