curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl : 7.56 multi form post

From: Patrick Monnerat via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 13 Oct 2017 13:39:30 +0100

On 10/13/2017 12:55 PM, Sasikala Raju wrote:
>
> With curl 7.56 , multi form post have some discrepancy in sending the
> data. Why is the disposition header changed ? How can we force form
> data instead of attachment.
>
> Private: 002e: Content-Disposition: form-data; name="filename" -> 7.54
>
> Private: 069c: Content-Disposition: attachment; name="filename" ->7.56
>

If no special content disposition is set by the caller, libcurl sets it
as "form-data" if the parent part has content type
"multipart/form-data", else "attachment".

You can force another content disposition by forging the full header
yourself and setting it in the part, as it is done in

https://github.com/curl/curl/blob/master/docs/examples/smtp-mime.c#L127.
In that case, the field name and filename set for the part are ignored.

I have no global view of what you are doing and of your mime structure:
I can imagine you use the mime API and the context is not HTTP (probably
SMTP or IMAP) or the part is a subpart of the parent part that has not a
"multipart/form-data" content type. This later case is not standard.

If you still use the form API, individual multiple file field parts
always add a content disposition of "attachment" since the parent part
(the one that represents your field) is not of content type
"multipart/form-data".
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-10-13