mime: add client reader

Add `mime` client reader. Encapsulates reading from mime parts, getting
their length, rewinding and unpausing.

- remove special mime handling from sendf.c and easy.c
- add general "unpause" method to client readers
- use new reader in http/imap/smtp
- make some mime functions static that are now only used internally

In addition:
- remove flag 'forbidchunk' as no longer needed

Closes #13039
This commit is contained in:
Stefan Eissing 2024-02-29 10:12:39 +01:00 committed by Daniel Stenberg
parent 6c632b216b
commit 0ba47146f7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 370 additions and 129 deletions

View file

@ -786,20 +786,19 @@ static CURLcode imap_perform_append(struct Curl_easy *data)
result = Curl_mime_add_header(&data->set.mimepost.curlheaders,
"Mime-Version: 1.0");
/* Make sure we will read the entire mime structure. */
if(!result)
result = Curl_mime_rewind(&data->set.mimepost);
result = Curl_creader_set_mime(data, &data->set.mimepost);
if(result)
return result;
data->state.infilesize = Curl_mime_size(&data->set.mimepost);
/* Read from mime structure. */
data->state.fread_func = (curl_read_callback) Curl_mime_read;
data->state.in = (void *) &data->set.mimepost;
data->state.infilesize = Curl_creader_client_length(data);
}
else
#endif
{
result = Curl_creader_set_fread(data, data->state.infilesize);
if(result)
return result;
}
/* Check we know the size of the upload */
if(data->state.infilesize < 0) {