summaryrefslogtreecommitdiff
path: root/lib/mime.c
Commit message (Collapse)AuthorAgeFilesLines
* mime: make Curl_mime_duppart() assert if called without valid dstDaniel Stenberg2019-09-201-6/+6
| | | | | Fixes warning detected by PVS-Studio Fixes #4374
* mime: when disabled, avoid C99 macroDaniel Stenberg2019-09-181-0/+7
| | | | Closes #4368
* mime: acknowledge CURL_DISABLE_MIMEDaniel Stenberg2019-05-131-71/+3
|
* build: fix "clarify calculation precedence" warningsMarcel Raad2019-05-121-2/+4
| | | | | | | Codacy/CppCheck warns about this. Consistently use parentheses as we already do in some places to silence the warning. Closes https://github.com/curl/curl/pull/3866
* mime: put the boundary buffer into the curl_mime structDaniel Stenberg2019-02-121-12/+2
| | | | | | | ... instead of allocating it separately and point to it. It is fixed-size and always used for each part. Closes #3561
* mime: check Curl_rand_hex's return codeDaniel Stenberg2018-07-281-2/+7
| | | | | | Bug: https://curl.haxx.se/mail/archive-2018-07/0015.html Reported-by: Jeffrey Walton Closes #2795
* cppcheck: fix warningsMarian Klymov2018-06-111-21/+11
| | | | | | | | | | | | | - Get rid of variable that was generating false positive warning (unitialized) - Fix issues in tests - Reduce scope of several variables all over etc Closes #2631
* checksrc: make sure sizeof() is used *with* parenthesesDaniel Stenberg2018-05-211-6/+6
| | | | | | ... and unify the source code to adhere. Closes #2563
* mime: avoid NULL pointer dereference riskDaniel Stenberg2018-04-241-1/+1
| | | | | | Coverity detected, CID 1435120 Closes #2527
* build: add picky compiler warning flags for gcc 6 and 7Eric Gallager2018-04-071-1/+4
|
* cleanup: misc typos in strings and commentsluz.paz2018-03-161-1/+1
| | | | | | Found via `codespell` Closes #2389
* formdata: use the mime-content type functionDaniel Stenberg2018-02-051-9/+4
| | | | | | | | | | Reduce code duplication by making Curl_mime_contenttype available and used by the formdata function. This also makes the formdata function recognize a set of more file extensions by default. PR #2280 brought this to my attention. Closes #2282
* mime: clone mime tree upon easy handle duplication.Patrick Monnerat2018-01-141-1/+80
| | | | | | | | | | | | | | | | | | | | | A mime tree attached to an easy handle using CURLOPT_MIMEPOST is strongly bound to the handle: there is a pointer to the easy handle in each item of the mime tree and following the parent pointer list of mime items ends in a dummy part stored within the handle. Because of this binding, a mime tree cannot be shared between different easy handles, thus it needs to be cloned upon easy handle duplication. There is no way for the caller to get the duplicated mime tree handle: it is then set to be automatically destroyed upon freeing the new easy handle. New test 654 checks proper mime structure duplication/release. Add a warning note in curl_mime_data_cb() documentation about sharing user data between duplicated handles. Closes #2235
* mime: fix "Value stored to 'sz' is never read" scan-build errorDaniel Stenberg2017-11-211-2/+0
|
* mime: do not reuse previously computed multipart sizePatrick Monnerat2017-10-201-1/+1
| | | | | | | The contents might have changed: size must be recomputed. Reported-by: moteus on github Fixes #1999
* mime: limit bas64-encoded lines length to 76 charactersPatrick Monnerat2017-10-191-2/+2
|
* mime: do not call failf() if easy handle is NULL.Patrick Monnerat2017-10-131-1/+2
|
* mime: fix the content reader to handle >16K data properlyDaniel Stenberg2017-10-131-2/+1
| | | | | Reported-by: Jeroen Ooms Closes #1988
* mime: keep "text/plain" content type if user-specified.Patrick Monnerat2017-10-121-8/+11
| | | | | | Include test cases in 554, 587, 650. Fixes https://github.com/curl/curl/issues/1986
* mime: properly unbind mime structure in curl_mime_free().Patrick Monnerat2017-10-091-0/+1
| | | | | | | This allows freeing a mime structure bound to the easy handle before curl_easy_cleanup(). Fixes #1970.
* mime: refuse to add subparts to one of their own descendants.Patrick Monnerat2017-10-081-0/+15
| | | | | Reported-by: Alexey Melnichuk Fixes #1962
* mime: avoid resetting a part's encoder when part's contents change.Patrick Monnerat2017-10-081-1/+0
|
* mime: improve unbinding top multipart from easy handle.Patrick Monnerat2017-10-081-10/+41
| | | | Also avoid dangling pointers in referencing parts.
* mime: be tolerant about setting twice the same header list in a part.Patrick Monnerat2017-10-081-1/+2
|
* form/mime: field names are not allowed to contain zero-valued bytes.Patrick Monnerat2017-09-221-31/+13
| | | | | Also suppress length argument of curl_mime_name() (names are always zero-terminated).
* mime: rephrase the multipart output state machine (#1898) ...Patrick Monnerat2017-09-201-2/+5
| | | | ... in hope coverity will like it much.
* mime: fix an explicit null dereference (#1899)Patrick Monnerat2017-09-201-2/+2
|
* mime:escape_string minor clarification changeDaniel Stenberg2017-09-181-2/+5
| | | | | | | ... as it also removes a warning with old gcc versions. Bug: https://curl.haxx.se/mail/lib-2017-09/0049.html Reported-by: Ben Greear
* code style: use spaces around plusesDaniel Stenberg2017-09-111-1/+1
|
* code style: use spaces around equals signsDaniel Stenberg2017-09-111-2/+2
|
* Curl_checkheaders: make it available for IMAP and SMTP tooDaniel Stenberg2017-09-111-1/+1
| | | | | | ... not only HTTP uses this now. Closes #1875
* mime: drop internal FILE * support.Patrick Monnerat2017-09-061-127/+58
| | | | | | | | - 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.
* mime: fix a trivial warning.Patrick Monnerat2017-09-051-1/+0
|
* mime: replace 'struct Curl_mimepart' by 'curl_mimepart' in encoder code.Patrick Monnerat2017-09-051-19/+18
| | | | mime_state is now a typedef.
* mime: implement encoders.Patrick Monnerat2017-09-051-15/+452
| | | | | | | | curl_mime_encoder() is operational and documented. curl tool -F option is extended with ";encoder=". curl tool --libcurl option generates calls to curl_mime_encoder(). New encoder tests 648 & 649. Test 1404 extended with an encoder specification.
* mime: unified to use the typedef'd mime structs everywhereDaniel Stenberg2017-09-051-51/+51
| | | | ... and slightly edited to follow our code style better.
* mime: use CURL_ZERO_TERMINATED in examplesViktor Szakats2017-09-041-3/+3
| | | | and some minor whitespace fixes
* mime: use size_t instead of ssize_t in public API interface.Patrick Monnerat2017-09-031-9/+11
| | | | | | | | | To support telling a string is nul-terminated, symbol CURL_ZERO_TERMINATED has been introduced. Documentation updated accordingly. symbols in versions updated. Added form API symbols deprecation info.
* mime: remove support "-" stdin pseudo-file name in curl_mime_filedata().Patrick Monnerat2017-09-031-4/+11
| | | | | | | | | | | | | | | This feature is badly supported in Windows: as a replacement, a caller has to use curl_mime_data_cb() with fread, fseek and possibly fclose callbacks to process opened files. The cli tool and documentation are updated accordingly. The feature is however kept internally for form API compatibility, with the known caveats it always had. As a side effect, stdin size is not determined by the cli tool even if possible and this results in a chunked transfer encoding. Test 173 is updated accordingly.
* mime: fix some implicit curl_off_t --> size_t conversion warnings.Patrick Monnerat2017-09-031-2/+2
|
* mime: new MIME API.Patrick Monnerat2017-09-021-0/+1497
Available in HTTP, SMTP and IMAP. Deprecates the FORM API. See CURLOPT_MIMEPOST. Lib code and associated documentation.