aboutsummaryrefslogtreecommitdiff
path: root/lib/urldata.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-03-27 12:14:57 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-03-28 13:27:49 +0200
commit452203341d6e97b8f52f9a886046d9fdb96346a9 (patch)
treec5aa7fa5e29da5a1799123703be46f28d0491fc1 /lib/urldata.h
parent7975d10cf8a3fe9b35867509b9ef10d06614eb3a (diff)
pause: handle mixed types of data when paused
When receiving chunked encoded data with trailers, and the write callback returns PAUSE, there might be both body and header to store to resend on unpause. Previously libcurl returned error for that case. Added test case 1540 to verify. Reported-by: Stephen Toub Fixes #1354 Closes #1357
Diffstat (limited to 'lib/urldata.h')
-rw-r--r--lib/urldata.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/urldata.h b/lib/urldata.h
index 3ec7e0f16..9b3849117 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1294,6 +1294,19 @@ struct Curl_http2_dep {
struct Curl_easy *data;
};
+/*
+ * This struct is for holding data that was attemped to get sent to the user's
+ * callback but is held due to pausing. One instance per type (BOTH, HEADER,
+ * BODY).
+ */
+struct tempbuf {
+ char *buf; /* allocated buffer to keep data in when a write callback
+ returns to make the connection paused */
+ size_t len; /* size of the 'tempwrite' allocated buffer */
+ int type; /* type of the 'tempwrite' buffer as a bitmask that is used with
+ Curl_client_write() */
+};
+
struct UrlState {
/* Points to the connection cache */
@@ -1327,11 +1340,8 @@ struct UrlState {
int first_remote_port; /* remote port of the first (not followed) request */
struct curl_ssl_session *session; /* array of 'max_ssl_sessions' size */
long sessionage; /* number of the most recent session */
- char *tempwrite; /* allocated buffer to keep data in when a write
- callback returns to make the connection paused */
- size_t tempwritesize; /* size of the 'tempwrite' allocated buffer */
- int tempwritetype; /* type of the 'tempwrite' buffer as a bitmask that is
- used with Curl_client_write() */
+ unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
+ struct tempbuf tempwrite[3]; /* BOTH, HEADER, BODY */
char *scratch; /* huge buffer[BUFSIZE*2] when doing upload CRLF replacing */
bool errorbuf; /* Set to TRUE if the error buffer is already filled in.
This must be set to FALSE every time _easy_perform() is