1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

set the 'retry' bit to TRUE when the connection is about to be retried,

this allows the HTTP code to *not* return a failure just because no data
has been received from the server
This commit is contained in:
Daniel Stenberg 2004-02-02 14:49:54 +00:00
parent 9eb6fc1fb6
commit b84eaff1d5
4 changed files with 20 additions and 3 deletions

View File

@ -1028,9 +1028,11 @@ CURLcode Curl_http_done(struct connectdata *conn)
else if(HTTPREQ_PUT == data->set.httpreq) else if(HTTPREQ_PUT == data->set.httpreq)
conn->bytecount = http->readbytecount + http->writebytecount; conn->bytecount = http->readbytecount + http->writebytecount;
if(0 == (http->readbytecount + conn->headerbytecount)) { if(!conn->bits.retry &&
/* nothing was read from the HTTP server, this can't be right !(http->readbytecount + conn->headerbytecount)) {
so we return an error here */ /* If this connection isn't simply closed to be retried, AND nothing was
read from the HTTP server, this can't be right so we return an error
here */
failf(data, "Empty reply from server"); failf(data, "Empty reply from server");
return CURLE_GOT_NOTHING; return CURLE_GOT_NOTHING;
} }

View File

@ -51,7 +51,9 @@
#ifdef HAVE_NET_IF_H #ifdef HAVE_NET_IF_H
#include <net/if.h> #include <net/if.h>
#endif #endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif
/* -- if2ip() -- */ /* -- if2ip() -- */
#ifdef HAVE_NETDB_H #ifdef HAVE_NETDB_H

View File

@ -29,7 +29,9 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
@ -44,7 +46,9 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
@ -56,7 +60,9 @@
#ifdef HAVE_NET_IF_H #ifdef HAVE_NET_IF_H
#include <net/if.h> #include <net/if.h>
#endif #endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif
#include <signal.h> #include <signal.h>
#ifdef HAVE_SYS_PARAM_H #ifdef HAVE_SYS_PARAM_H
@ -1910,6 +1916,11 @@ CURLcode Curl_perform(struct SessionHandle *data)
newurl = strdup(conn->data->change.url); newurl = strdup(conn->data->change.url);
conn->bits.close = TRUE; /* close this connection */ conn->bits.close = TRUE; /* close this connection */
conn->bits.retry = TRUE; /* mark this as a connection we're about
to retry. Marking it this way should
prevent i.e HTTP transfers to return
error just because nothing has been
transfered! */
} }
else else
/* /*

View File

@ -296,6 +296,8 @@ struct ConnectBits {
bool tcpconnect; /* the tcp stream (or simimlar) is connected, this bool tcpconnect; /* the tcp stream (or simimlar) is connected, this
is set the first time on the first connect function is set the first time on the first connect function
call */ call */
bool retry; /* this connection is about to get closed and then
re-attempted at another connection. */
}; };
/* /*