diff options
author | Brad King <brad.king@kitware.com> | 2018-05-18 14:16:50 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-05-18 14:16:50 (GMT) |
commit | 3e913b819d8d8118d5e8dc3b7289f622e9ca92e5 (patch) | |
tree | 82c19f5ec814c84b986e54e3fc6fa0a83622fd81 /Utilities/cmcurl/lib/mime.c | |
parent | f3c73b878c594d40119e480ca1074e733d7ba1ce (diff) | |
parent | d431136e029c652f5913bcebeaab3b9236b114c4 (diff) | |
download | CMake-3e913b819d8d8118d5e8dc3b7289f622e9ca92e5.zip CMake-3e913b819d8d8118d5e8dc3b7289f622e9ca92e5.tar.gz CMake-3e913b819d8d8118d5e8dc3b7289f622e9ca92e5.tar.bz2 |
Merge branch 'upstream-curl' into update-curl
* upstream-curl:
curl 2018-05-15 (cb013830)
Diffstat (limited to 'Utilities/cmcurl/lib/mime.c')
-rw-r--r-- | Utilities/cmcurl/lib/mime.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Utilities/cmcurl/lib/mime.c b/Utilities/cmcurl/lib/mime.c index e0853a9..4c0d2eeb 100644 --- a/Utilities/cmcurl/lib/mime.c +++ b/Utilities/cmcurl/lib/mime.c @@ -51,10 +51,6 @@ #endif -#define FILE_CONTENTTYPE_DEFAULT "application/octet-stream" -#define MULTIPART_CONTENTTYPE_DEFAULT "multipart/mixed" -#define DISPOSITION_DEFAULT "attachment" - #define READ_ERROR ((size_t) -1) /* Encoders. */ @@ -245,7 +241,7 @@ static FILE * vmsfopenread(const char *file, const char *mode) static char *Curl_basename(char *path) { /* Ignore all the details above for now and make a quick and simple - implementaion here */ + implementation here */ char *s1; char *s2; @@ -1197,7 +1193,10 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const curl_mimepart *src) } /* Duplicate other fields. */ - dst->encoder = src->encoder; + if(dst != NULL) + dst->encoder = src->encoder; + else + res = CURLE_WRITE_ERROR; if(!res) res = curl_mime_type(dst, src->mimetype); if(!res) @@ -1206,7 +1205,7 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const curl_mimepart *src) res = curl_mime_filename(dst, src->filename); /* If an error occurred, rollback. */ - if(res) + if(res && dst) Curl_mime_cleanpart(dst); return res; @@ -1642,8 +1641,7 @@ static CURLcode add_content_type(struct curl_slist **slp, boundary? boundary: ""); } - -static const char *ContentTypeForFilename(const char *filename) +const char *Curl_mime_contenttype(const char *filename) { unsigned int i; @@ -1715,14 +1713,14 @@ CURLcode Curl_mime_prepare_headers(curl_mimepart *part, contenttype = MULTIPART_CONTENTTYPE_DEFAULT; break; case MIMEKIND_FILE: - contenttype = ContentTypeForFilename(part->filename); + contenttype = Curl_mime_contenttype(part->filename); if(!contenttype) - contenttype = ContentTypeForFilename(part->data); + contenttype = Curl_mime_contenttype(part->data); if(!contenttype && part->filename) contenttype = FILE_CONTENTTYPE_DEFAULT; break; default: - contenttype = ContentTypeForFilename(part->filename); + contenttype = Curl_mime_contenttype(part->filename); break; } } |