diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-01-15 00:11:33 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-01-15 00:14:46 +0100 |
commit | 7c325972dc82f8ca8f493c6afe335810e7158547 (patch) | |
tree | 5c2e839a5fedba41443d725bfdb1e0eca0b889eb /lib/mime.c | |
parent | be578eea7e4d97a3c74fc7e1341ee258925e08ff (diff) | |
download | curl-7c325972dc82f8ca8f493c6afe335810e7158547.tar.gz |
mime: return CURL_READFUNC_ABORT back to parentbagder/mime-callback-abort
When *ABORT is returned from the callback, the transfer must stop
immediately and the return code must be passed back to the parent all
the way up to Curl_fillreadbuffer().
Test 644 was supposed to verify this but it wasn't done right. Now it
makes sure the callback is never called again after CURL_READFUNC_ABORT
is returned and it also makes sure the data transfer is actually
stopped as instructed.
Also removed the 'flaky' keyword since the test is now modified.
Fixes #4813
Reported-by: MrdUkk on github
Diffstat (limited to 'lib/mime.c')
-rw-r--r-- | lib/mime.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/mime.c b/lib/mime.c index 081e51e50..fe005a1e8 100644 --- a/lib/mime.c +++ b/lib/mime.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 @@ -765,6 +765,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, break; case CURL_READFUNC_ABORT: case CURL_READFUNC_PAUSE: + return sz; case READ_ERROR: return cursize? cursize: sz; default: @@ -794,6 +795,7 @@ static size_t read_encoded_part_content(curl_mimepart *part, break; case CURL_READFUNC_ABORT: case CURL_READFUNC_PAUSE: + return sz; case READ_ERROR: return cursize? cursize: sz; default: @@ -878,10 +880,11 @@ static size_t readback_part(curl_mimepart *part, part->fp = NULL; } /* FALLTHROUGH */ - case CURL_READFUNC_ABORT: - case CURL_READFUNC_PAUSE: case READ_ERROR: return cursize? cursize: sz; + case CURL_READFUNC_ABORT: + case CURL_READFUNC_PAUSE: + return sz; } break; case MIMESTATE_END: @@ -966,6 +969,7 @@ static size_t mime_subparts_read(char *buffer, size_t size, size_t nitems, switch(sz) { case CURL_READFUNC_ABORT: case CURL_READFUNC_PAUSE: + return sz; case READ_ERROR: return cursize? cursize: sz; case 0: |