Loading lib/ftp.c +10 −3 Original line number Diff line number Diff line Loading @@ -267,9 +267,16 @@ int Curl_GetFTPResponse(char *buf, ftp->cache = NULL; /* clear the pointer */ ftp->cache_size = 0; /* zero the size just in case */ } else if(CURLE_OK != Curl_read(conn, sockfd, ptr, BUFSIZE-nread, &gotbytes)) else { int res = Curl_read(conn, sockfd, ptr, BUFSIZE-nread, &gotbytes); if(res < 0) /* EWOULDBLOCK */ continue; /* go looping again */ if(CURLE_OK != res) keepon = FALSE; } if(!keepon) ; Loading lib/http.c +7 −2 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, int subversion=0; struct SessionHandle *data=conn->data; CURLcode result; int res; int nread; /* total size read */ int perline; /* count bytes per line */ Loading Loading @@ -317,8 +318,12 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, * to read, but when we use Curl_read() it may do so. Do confirm * that this is still ok and then remove this comment! */ if(CURLE_OK != Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes)) res= Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes); if(res< 0) /* EWOULDBLOCK */ continue; /* go loop yourself */ else if(res) keepon = FALSE; else if(gotbytes <= 0) { keepon = FALSE; Loading lib/sendf.c +21 −5 Original line number Diff line number Diff line Loading @@ -266,13 +266,17 @@ CURLcode Curl_client_write(struct SessionHandle *data, return CURLE_OK; } /* * Internal read-from-socket function. This is meant to deal with plain * sockets, SSL sockets and kerberos sockets. * * If the read would block (EWOULDBLOCK) we return -1. Otherwise we return * a regular CURLcode value. */ CURLcode Curl_read(struct connectdata *conn, int sockfd, char *buf, size_t buffersize, int Curl_read(struct connectdata *conn, int sockfd, char *buf, size_t buffersize, ssize_t *n) { ssize_t nread; Loading Loading @@ -300,7 +304,9 @@ CURLcode Curl_read(struct connectdata *conn, int sockfd, /* if there's data pending, then we re-invoke SSL_read() */ break; } } while(loop && SSL_pending(conn->ssl.handle)); } while(0); if(loop && SSL_pending(conn->ssl.handle)) return -1; /* basicly EWOULDBLOCK */ } else { #endif Loading @@ -310,6 +316,16 @@ CURLcode Curl_read(struct connectdata *conn, int sockfd, else #endif nread = sread (sockfd, buf, buffersize); if(-1 == nread) { #ifdef WIN32 if(EWOULDBLOCK == GetLastError()) #else if(EWOULDBLOCK == errno) #endif return -1; } #ifdef USE_SSLEAY } #endif /* USE_SSLEAY */ Loading lib/sendf.h +3 −3 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ CURLcode Curl_client_write(struct SessionHandle *data, int type, char *ptr, size_t len); /* internal read-function, does plain socket, SSL and krb4 */ CURLcode Curl_read(struct connectdata *conn, int sockfd, int Curl_read(struct connectdata *conn, int sockfd, char *buf, size_t buffersize, ssize_t *n); /* internal write-function, does plain socket, SSL and krb4 */ Loading lib/telnet.c +2 −0 Original line number Diff line number Diff line Loading @@ -1116,6 +1116,7 @@ CURLcode Curl_telnet(struct connectdata *conn) { if(events.lNetworkEvents & FD_READ) { /* This reallu OUGHT to check its return code. */ Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); telrcv(conn, (unsigned char *)buf, nread); Loading Loading @@ -1176,6 +1177,7 @@ CURLcode Curl_telnet(struct connectdata *conn) } if(FD_ISSET(sockfd, &readfd)) { /* This OUGHT to check the return code... */ Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); /* if we receive 0 or less here, the server closed the connection and Loading Loading
lib/ftp.c +10 −3 Original line number Diff line number Diff line Loading @@ -267,9 +267,16 @@ int Curl_GetFTPResponse(char *buf, ftp->cache = NULL; /* clear the pointer */ ftp->cache_size = 0; /* zero the size just in case */ } else if(CURLE_OK != Curl_read(conn, sockfd, ptr, BUFSIZE-nread, &gotbytes)) else { int res = Curl_read(conn, sockfd, ptr, BUFSIZE-nread, &gotbytes); if(res < 0) /* EWOULDBLOCK */ continue; /* go looping again */ if(CURLE_OK != res) keepon = FALSE; } if(!keepon) ; Loading
lib/http.c +7 −2 Original line number Diff line number Diff line Loading @@ -235,6 +235,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, int subversion=0; struct SessionHandle *data=conn->data; CURLcode result; int res; int nread; /* total size read */ int perline; /* count bytes per line */ Loading Loading @@ -317,8 +318,12 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn, * to read, but when we use Curl_read() it may do so. Do confirm * that this is still ok and then remove this comment! */ if(CURLE_OK != Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes)) res= Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread, &gotbytes); if(res< 0) /* EWOULDBLOCK */ continue; /* go loop yourself */ else if(res) keepon = FALSE; else if(gotbytes <= 0) { keepon = FALSE; Loading
lib/sendf.c +21 −5 Original line number Diff line number Diff line Loading @@ -266,13 +266,17 @@ CURLcode Curl_client_write(struct SessionHandle *data, return CURLE_OK; } /* * Internal read-from-socket function. This is meant to deal with plain * sockets, SSL sockets and kerberos sockets. * * If the read would block (EWOULDBLOCK) we return -1. Otherwise we return * a regular CURLcode value. */ CURLcode Curl_read(struct connectdata *conn, int sockfd, char *buf, size_t buffersize, int Curl_read(struct connectdata *conn, int sockfd, char *buf, size_t buffersize, ssize_t *n) { ssize_t nread; Loading Loading @@ -300,7 +304,9 @@ CURLcode Curl_read(struct connectdata *conn, int sockfd, /* if there's data pending, then we re-invoke SSL_read() */ break; } } while(loop && SSL_pending(conn->ssl.handle)); } while(0); if(loop && SSL_pending(conn->ssl.handle)) return -1; /* basicly EWOULDBLOCK */ } else { #endif Loading @@ -310,6 +316,16 @@ CURLcode Curl_read(struct connectdata *conn, int sockfd, else #endif nread = sread (sockfd, buf, buffersize); if(-1 == nread) { #ifdef WIN32 if(EWOULDBLOCK == GetLastError()) #else if(EWOULDBLOCK == errno) #endif return -1; } #ifdef USE_SSLEAY } #endif /* USE_SSLEAY */ Loading
lib/sendf.h +3 −3 Original line number Diff line number Diff line Loading @@ -45,7 +45,7 @@ CURLcode Curl_client_write(struct SessionHandle *data, int type, char *ptr, size_t len); /* internal read-function, does plain socket, SSL and krb4 */ CURLcode Curl_read(struct connectdata *conn, int sockfd, int Curl_read(struct connectdata *conn, int sockfd, char *buf, size_t buffersize, ssize_t *n); /* internal write-function, does plain socket, SSL and krb4 */ Loading
lib/telnet.c +2 −0 Original line number Diff line number Diff line Loading @@ -1116,6 +1116,7 @@ CURLcode Curl_telnet(struct connectdata *conn) { if(events.lNetworkEvents & FD_READ) { /* This reallu OUGHT to check its return code. */ Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); telrcv(conn, (unsigned char *)buf, nread); Loading Loading @@ -1176,6 +1177,7 @@ CURLcode Curl_telnet(struct connectdata *conn) } if(FD_ISSET(sockfd, &readfd)) { /* This OUGHT to check the return code... */ Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread); /* if we receive 0 or less here, the server closed the connection and Loading