curl / Mailing Lists / curl-library / Single Mail

curl-library

Formpost API replacement

From: Patrick Monnerat via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 17 Aug 2017 18:07:37 +0100

I have started coding the old form API replacement as a wider MIME API.
It's still incomplete, although already usable.

Please check https://github.com/monnerat/curl/tree/mime.

The base spec I used is
https://github.com/curl/curl/wiki/formpost-API-redesigned, slightly updated:

- All functions and types are named curl_mime_xxx instead of
curl_form_xxx: this better marks the difference with the old formpost
API and emphasises the possible use for mail data.

- curl_mime_headers() takes an additional "take_ownership" parameter
that causes the header list to be freed upon part deletion.

- curl_mime_file(part, fileptr, closewhendone) behaves has
curl_mime_filedata() but takes a FILE * argument instead of a file name:
this extends the "-" --> stdin exception of the old formpost API.

- curl_mime_subparts(part, mime) sets the part as multipart data from
the given mime structure. This can be nested at any level. Subparts will
be deleted upon top-level mime freeing.

- curl_mime_encoder(part, encoding) asks to encode data for transfer
(base64, quoted-printable,...).

- CURLOPT_MIMEPOST sets mime data to be sent.

This is a work in progress and I want to know if I have to carry on in
this direction, commit, create git branch or give up.

Here is the current state:

- Works for http: tests 589, 643 and 644. Chunked encoding is used if
the data size is unknown.

- Works for smtp: no automated test yet, but I've been able to send
myself legal mime e-mail with multi-level multiparts (alternatives,
attachments, etc).

- Not yet implemented for imap.

- Not yet used by the curl command line tool.

- No man/doc for new API and option (test1139 fails).

- CURL_EXTERN entry points unordered (test1135 fails). Time to bump
soname (and throw away the dirty SONAME_BUMP hack) ?

- Transfer encoders not yet implemented.

Thanks for your evaluations, testing, fixes and comments.

Patrick

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-08-17