summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/sendf.c
diff options
context:
space:
mode:
Diffstat (limited to 'Utilities/cmcurl/lib/sendf.c')
-rw-r--r--Utilities/cmcurl/lib/sendf.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/Utilities/cmcurl/lib/sendf.c b/Utilities/cmcurl/lib/sendf.c
index 5913ea4..6ef47aa 100644
--- a/Utilities/cmcurl/lib/sendf.c
+++ b/Utilities/cmcurl/lib/sendf.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -36,13 +36,14 @@
#include "sendf.h"
#include "connect.h"
#include "vtls/vtls.h"
-#include "ssh.h"
+#include "vssh/ssh.h"
#include "easyif.h"
#include "multiif.h"
#include "non-ascii.h"
#include "strerror.h"
#include "select.h"
#include "strdup.h"
+#include "http2.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -224,7 +225,7 @@ bool Curl_recv_has_postponed_data(struct connectdata *conn, int sockindex)
(void)sockindex;
return false;
}
-#define pre_receive_plain(c,n) do {} WHILE_FALSE
+#define pre_receive_plain(c,n) do {} while(0)
#define get_pre_recved(c,n,b,l) 0
#endif /* ! USE_RECV_BEFORE_SEND_WORKAROUND */
@@ -501,6 +502,9 @@ static CURLcode pausewrite(struct Curl_easy *data,
unsigned int i;
bool newtype = TRUE;
+ /* If this transfers over HTTP/2, pause the stream! */
+ Curl_http2_stream_pause(data, TRUE);
+
if(s->tempcount) {
for(i = 0; i< s->tempcount; i++) {
if(s->tempwrite[i].type == type) {
@@ -529,6 +533,8 @@ static CURLcode pausewrite(struct Curl_easy *data,
/* update the pointer and the size */
s->tempwrite[i].buf = newptr;
s->tempwrite[i].len = newlen;
+
+ len = newlen; /* for the debug output below */
}
else {
dupl = Curl_memdup(ptr, len);
@@ -692,19 +698,20 @@ CURLcode Curl_read_plain(curl_socket_t sockfd,
ssize_t nread = sread(sockfd, buf, bytesfromsocket);
if(-1 == nread) {
- int err = SOCKERRNO;
- int return_error;
+ const int err = SOCKERRNO;
+ const bool return_error =
#ifdef USE_WINSOCK
- return_error = WSAEWOULDBLOCK == err;
+ WSAEWOULDBLOCK == err
#else
- return_error = EWOULDBLOCK == err || EAGAIN == err || EINTR == err;
+ EWOULDBLOCK == err || EAGAIN == err || EINTR == err
#endif
+ ;
+ *n = 0; /* no data returned */
if(return_error)
return CURLE_AGAIN;
return CURLE_RECV_ERROR;
}
- /* we only return number of bytes read when we return OK */
*n = nread;
return CURLE_OK;
}