cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Serverside disconnection vs. simple Closing connection #n

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 23 Apr 2009 22:37:08 +0200 (CEST)

On Thu, 23 Apr 2009, Istvan Hoffmann wrote:

> The main problem is here in my opinion that curl which is a lower level
> layer tries to decide what is error an what is not. I think letting the user
> decide what error she/he would like to ignore and what not is a much more
> better solution.

The main problem, to me, is that this server sends a HTTP stream and the
connection is closed and there is *NO* way for libcurl to know that this is an
error. Closing the connection is the only way that server can use to tell the
client about the end of the response-body.

libcurl cannot treat that as an error in general as it isn't a HTTP error.

I'd argue that it's only an error in your specific case because the server has
chosen the wrong way to provide the data since the client cannot tell the
difference between a broken connection and the end of the response.

Since it isn't a generic HTTP error, you'd need to know before-hand that
you're dealing with a weird server to set this option you propose. And since
you know this already, you can just as well - as Jamie said - adapt to the
situation without modifying libcurl and consider any breakage of connection as
an "error".

-- 
  / daniel.haxx.se
Received on 2009-04-23