diff options
Diffstat (limited to 'libs/libcurl/src/mime.c')
| -rw-r--r-- | libs/libcurl/src/mime.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/libcurl/src/mime.c b/libs/libcurl/src/mime.c index e9aba3488a..66dd0f2ed2 100644 --- a/libs/libcurl/src/mime.c +++ b/libs/libcurl/src/mime.c @@ -1561,6 +1561,14 @@ CURLcode Curl_mime_set_subparts(curl_mimepart *part, }
}
+ /* If subparts have already been used as a top-level MIMEPOST,
+ they might not be positioned at start. Rewind them now, as
+ a future check while rewinding the parent may cause this
+ content to be skipped. */
+ if(mime_subparts_seek(subparts, (curl_off_t) 0, SEEK_SET) !=
+ CURL_SEEKFUNC_OK)
+ return CURLE_SEND_FAIL_REWIND;
+
subparts->parent = part;
/* Subparts are processed internally: no read callback. */
part->seekfunc = mime_subparts_seek;
@@ -1590,8 +1598,8 @@ size_t Curl_mime_read(char *buffer, size_t size, size_t nitems, void *instream) (void) size; /* Always 1. */
- /* TODO: this loop is broken. If `nitems` is <= 4, some encoders will
- * return STOP_FILLING without adding any data and this loops infinitely. */
+ /* If `nitems` is <= 4, some encoders will return STOP_FILLING without
+ * adding any data and this loops infinitely. */
do {
hasread = FALSE;
ret = readback_part(part, buffer, nitems, &hasread);
@@ -2171,7 +2179,7 @@ static bool cr_mime_is_paused(struct Curl_easy *data, {
struct cr_mime_ctx *ctx = reader->ctx;
(void)data;
- return (ctx->part && ctx->part->lastreadstatus == CURL_READFUNC_PAUSE);
+ return ctx->part && ctx->part->lastreadstatus == CURL_READFUNC_PAUSE;
}
static const struct Curl_crtype cr_mime = {
|
