mirror of
https://github.com/curl/curl.git
synced 2026-08-25 01:03:31 +03:00
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:
parent
6c632b216b
commit
0ba47146f7
12 changed files with 370 additions and 129 deletions
17
lib/imap.c
17
lib/imap.c
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue