cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP/1.1 and HTTP/1.0

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 2 Sep 2008 10:04:38 +0200 (CEST)

On Mon, 1 Sep 2008, Dan Fandrich wrote:

> I've come up with a partial solution to this downgrade problem: it involves
> moving the httpversion variable from the SingleRequest struct to the
> connectdata struct. This makes some sense since it holds the HTTP version
> spoken by the remote server at the other end of the connection. But it
> breaks down when the remote server doesn't support keep-alive connections
> (likely most 1.0 servers) and the connection is torn down for every request,
> thus losing the version number for the next request.
>
> This one is tricky to solve properly. Keeping the remote server version as
> part of the session instead of (or in addition to) the connectdata won't be
> perfectly accurate since there's no way to know if the next request is going
> to go to the same server, especially in the presence of round-robin DNS,
> load balancing front-ends or even a redirect to a completely different
> server. It's probably a good enough approximation, though, and I'll try
> coding up something along those lines unless someone has a better idea.

It might be possible to (ab)use the DNS cache to store this information. If
the name is looked up again and the cache contains the host name, it will
return the same IP and libcurl will thus get back to the same host.

Sure, if the host uses IP-based load ballancing there may of course be a risk
of a changed HTTP version anyway but I would consider that a very shaky
arrangement that should have very little risk of appearing anywhere in the
wild for real.

-- 
  / daniel.haxx.se
Received on 2008-09-02