From c96d96bc5fd334f90fce04bfe89a9ecbbe8e6094 Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Wed, 6 Sep 2017 13:42:03 +0100 Subject: mime: drop internal FILE * support. - The part kind MIMEKIND_FILE and associated code are suppressed. - Seek data origin offset not used anymore: suppressed. - MIMEKIND_NAMEDFILE renamed MIMEKIND_FILE; associated fields/functions renamed accordingly. - Curl_getformdata() processes stdin via a callback. --- lib/formdata.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/formdata.c') diff --git a/lib/formdata.c b/lib/formdata.c index 9bfe7b542..61ae78d91 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -897,8 +897,16 @@ CURLcode Curl_getformdata(struct Curl_easy *data, clen = -1; if(post->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE)) { - if(!strcmp(file->contents, "-")) - result = Curl_mime_file(part, stdin, 0); + if(!strcmp(file->contents, "-")) { + /* There are a few cases where the code below won't work; in + particular, freopen(stdin) by the caller is not guaranteed + to result as expected. This feature has been kept for backward + compatibility: use of "-" pseudo file name should be avoided. */ + result = curl_mime_data_cb(part, (curl_off_t) -1, + (curl_read_callback) fread, + (curl_seek_callback) fseek, + NULL, (void *) stdin); + } else result = curl_mime_filedata(part, file->contents); if(!result && (post->flags & HTTPPOST_READFILE)) -- cgit v1.2.3