Curl_done() and the protocol-specific conn->curl_done() functions now all

take a CURLcode as a second argument, that is non-zero when Curl_done()
is called after an error was returned from Curl_do() (or similar).
This commit is contained in:
Daniel Stenberg
2004-05-12 12:06:39 +00:00
parent 1d7ce36791
commit d60c22572b
11 changed files with 54 additions and 25 deletions

View File

@@ -3229,6 +3229,8 @@ static CURLcode SetupConnection(struct connectdata *conn,
Curl_safefree(conn->allocptr.uagent);
conn->allocptr.uagent =
aprintf("User-Agent: %s\015\012", data->set.useragent);
if(!conn->allocptr.uagent)
return CURLE_OUT_OF_MEMORY;
}
}
@@ -3236,6 +3238,8 @@ static CURLcode SetupConnection(struct connectdata *conn,
Curl_safefree(conn->allocptr.accept_encoding);
conn->allocptr.accept_encoding =
aprintf("Accept-Encoding: %s\015\012", data->set.encoding);
if(!conn->allocptr.accept_encoding)
return CURLE_OUT_OF_MEMORY;
}
conn->bytecount = 0;
@@ -3340,7 +3344,9 @@ CURLcode Curl_async_resolved(struct connectdata *conn)
}
CURLcode Curl_done(struct connectdata *conn)
CURLcode Curl_done(struct connectdata *conn,
CURLcode status) /* an error if this is called after an
error was detected */
{
struct SessionHandle *data=conn->data;
CURLcode result;
@@ -3371,7 +3377,7 @@ CURLcode Curl_done(struct connectdata *conn)
/* this calls the protocol-specific function pointer previously set */
if(conn->curl_done)
result = conn->curl_done(conn);
result = conn->curl_done(conn, status);
else
result = CURLE_OK;
@@ -3423,7 +3429,7 @@ CURLcode Curl_do(struct connectdata **connp)
infof(data, "Re-used connection seems dead, get a new one\n");
conn->bits.close = TRUE; /* enforce close of this connection */
result = Curl_done(conn); /* we are so done with this */
result = Curl_done(conn, result); /* we are so done with this */
/* conn is no longer a good pointer */