summaryrefslogtreecommitdiff
path: root/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* whitespace fixesViktor Szakats2018-09-232-4/+3
| | | | | | | | | | | - replace tabs with spaces where possible - remove line ending spaces - remove double/triple newlines at EOF - fix a non-UTF-8 character - cleanup a few indentations/line continuations in manual examples Closes https://github.com/curl/curl/pull/3037
* unit1650: fix out of boundary accessDaniel Stenberg2018-09-231-4/+4
| | | | | Fixes #2987 Closes #3035
* DOH: add test case 1650 and 2100Daniel Stenberg2018-09-062-1/+288
|
* tests: add unit tests for url.cJim Fuller2018-09-053-1/+95
| | | | | Approved-by: Daniel Gustafsson Closes #2937
* ssl: set engine implicitly when a PKCS#11 URI is providedAnderson Toshiyuki Sasaki2018-08-081-0/+3
| | | | | | | | | | | This allows the use of PKCS#11 URI for certificates and keys without setting the corresponding type as "ENG" and the engine as "pkcs11" explicitly. If a PKCS#11 URI is provided for certificate, key, proxy_certificate or proxy_key, the corresponding type is set as "ENG" if not provided and the engine is set to "pkcs11" if not provided. Acked-by: Nikos Mavrogiannopoulos Closes #2333
* CMake: Update scripts to use consistent styleRuslan Baratov2018-07-171-4/+4
| | | | | Closes #2727 Reviewed-by: Sergei Nikulov
* cppcheck: fix warningsMarian Klymov2018-06-113-4/+4
| | | | | | | | | | | | | - 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
* CURLOPT_RESOLVE: always purge old entry firstAlibek.Jorajev2018-06-014-3/+228
| | | | | | If there's an existing entry using the selected name. Closes #2622
* fnmatch: use the system one if availableDaniel Stenberg2018-06-011-18/+80
| | | | | | | | | | | | | If configure detects fnmatch to be available, use that instead of our custom one for FTP wildcard pattern matching. For standard compliance, to reduce our footprint and to use already well tested and well exercised code. A POSIX fnmatch behaves slightly different than the internal function for a few test patterns currently and the macOS one yet slightly different. Test case 1307 is adjusted for these differences. Closes #2626
* fnmatch: insist on escaped bracket to matchDaniel Stenberg2018-05-281-4/+13
| | | | | | | | | | | | A non-escaped bracket ([) is for a character group - as documented. It will *not* match an individual bracket anymore. Test case 1307 updated accordingly to match. Problem detected by OSS-Fuzz, although this fix is probably not a final fix for the notorious timeout issues. Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8525 Closes #2614
* checksrc: make sure sizeof() is used *with* parenthesesDaniel Stenberg2018-05-212-3/+3
| | | | | | ... and unify the source code to adhere. Closes #2563
* curl_fnmatch: only allow two asterisks for matchingDaniel Stenberg2018-05-181-4/+0
| | | | | | | | | | | | | The previous limit of 5 can still end up in situation that takes a very long time and consumes a lot of CPU. If there is still a rare use case for this, a user can provide their own fnmatch callback for a version that allows a larger set of wildcards. This commit was triggered by yet another OSS-Fuzz timeout due to this. Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8369 Closes #2587
* tests: Fix format specifiersRikard Falkeborn2018-05-142-4/+4
|
* build: cleanup to fix clang warnings/errorsDaniel Stenberg2018-04-081-18/+11
| | | | | | | | | | unit1309 and vtls/gtls: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension Reported-by: Rikard Falkeborn Fixes #2466 Closes #2468
* resolve: add CURLOPT_DNS_SHUFFLE_ADDRESSESRick Deist2018-03-172-1/+75
| | | | | | | | | | | This patch adds CURLOPT_DNS_SHUFFLE_ADDRESSES to explicitly request shuffling of IP addresses returned for a hostname when there is more than one. This is useful when the application knows that a round robin approach is appropriate and is willing to accept the consequences of potentially discarding some preference order returned by the system's implementation. Closes #1694
* build: get CFLAGS (including -werror) used for examples and testsDaniel Stenberg2018-03-042-2/+4
| | | | | | ... so that the CI and more detects compiler warnings/errors properly! Closes #2337
* unit1307: proper cleanup on OOM to fix torture testsDan Fandrich2018-03-021-8/+18
|
* unit1309: fix warning on Windows x64Marcel Raad2018-02-281-5/+9
| | | | | | | | | | When targeting x64, MinGW-w64 complains about conversions between 32-bit long and 64-bit pointers. Fix this by reusing the GNUTLS_POINTER_TO_SOCKET_CAST / GNUTLS_SOCKET_TO_POINTER_CAST logic from gtls.c, moving it to warnless.h as CURLX_POINTER_TO_INTEGER_CAST / CURLX_INTEGER_TO_POINTER_CAST. Closes https://github.com/curl/curl/pull/2341
* CURLOPT_RESOLVE: Add support for multiple IP addresses per entryAnders Bakken2018-02-202-1/+207
| | | | | | | This enables users to preresolve but still take advantage of happy eyeballs and trying multiple addresses if some are not connecting. Ref: https://github.com/curl/curl/pull/2260
* fnmatch: pattern syntax can no longer failPatrick Monnerat2018-01-311-2/+3
| | | | | | | | | | | | Whenever an expected pattern syntax rule cannot be matched, the character starting the rule loses its special meaning and the parsing is resumed: - backslash at the end of pattern string matches itself. - Error in [:keyword:] results in set containing :\[dekorwy. Unit test 1307 updated for this new situation. Closes #2273
* fnmatch: accept an alphanum to be followed by a non-alphanum in char setPatrick Monnerat2018-01-311-3/+8
| | | | | | | Also be more tolerant about set pattern syntax. Update unit test 1307 accordingly. Bug: https://curl.haxx.se/mail/lib-2018-01/0114.html
* fnmatch: do not match the empty string with a character setPatrick Monnerat2018-01-311-2/+2
|
* unit1307: test many wildcards tooDaniel Stenberg2018-01-171-1/+5
|
* ftp-wildcard: fix matching an empty string with "*[^a]"Daniel Stenberg2018-01-171-13/+12
| | | | | | | | .... and avoid advancing the pointer to trigger an out of buffer read. Detected by OSS-fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5251 Assisted-by: Max Dymond
* time: rename Curl_tvnow to Curl_nowDaniel Stenberg2017-10-251-1/+1
| | | | | | | | | | ... since the 'tv' stood for timeval and this function does not return a timeval struct anymore. Also, cleaned up the Curl_timediff*() functions to avoid typecasts and clean up the descriptive comments. Closes #2011
* timediff: return timediff_t from the time diff functionsDaniel Stenberg2017-10-251-1/+1
| | | | | | | | | | | | | | | ... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
* code style: use spaces around plusesDaniel Stenberg2017-09-112-8/+8
|
* code style: use spaces around equals signsDaniel Stenberg2017-09-117-13/+13
|
* mime: tests and examples.Patrick Monnerat2017-09-021-3/+3
| | | | | | | | | | Additional mime-specific tests. Existing tests updated to reflect small differences (Expect: 100-continue, data size change due to empty lines, etc). Option -F headers= keyword added to tests. test1135 disabled until the entry point order change is resolved. New example smtp-mime. Examples postit2 and multi-post converted from form API to mime API.
* unit1301: fix error message on first testDaniel Stenberg2017-08-311-2/+2
|
* unit1606: Fixed shadowed variable warningDan Fandrich2017-08-281-8/+7
|
* tests: Make sure libtests & unittests call curl_global_cleanup()Dan Fandrich2017-08-266-21/+44
| | | | These were missed in commit c468c27b.
* progress: Track total times following redirectsRyan Winograd2017-08-151-39/+56
| | | | | | | | | | | | | | | | | | | | | | Update the progress timers `t_nslookup`, `t_connect`, `t_appconnect`, `t_pretransfer`, and `t_starttransfer` to track the total times for these activities when a redirect is followed. Previously, only the times for the most recent request would be tracked. Related changes: - Rename `Curl_pgrsResetTimesSizes` to `Curl_pgrsResetTransferSizes` now that the function only resets transfer sizes and no longer modifies any of the progress timers. - Add a bool to the `Progress` struct that is used to prevent double-counting `t_starttransfer` times. Added test case 1399. Fixes #522 and Known Bug 1.8 Closes #1602 Reported-by: joshhe on github
* docs/comments: Update to secure URL versionsViktor Szakats2017-08-081-1/+1
| | | | Closes #1741
* test1323: verify curlx_tvdiffDaniel Stenberg2017-07-282-1/+71
|
* timeval: struct curltime is a struct timeval replacementDaniel Stenberg2017-07-284-9/+12
| | | | | | | | | ... to make all libcurl internals able to use the same data types for the struct members. The timeval struct differs subtly on several platforms so it makes it cumbersome to use everywhere. Ref: #1652 Closes #1693
* unit1399: fix integer overflowRyan Winograd2017-07-031-1/+1
| | | | | Bug: #1616 Closes #1633
* unit1399: add logging to time comparisonDaniel Stenberg2017-07-011-1/+5
| | | | | | ... to enable tracking down why autobuilds fail on this Bug: #1616
* progress: prevent resetting t_starttransferRyan Winograd2017-06-302-0/+100
| | | | | | | | | | | | | Prevent `Curl_pgrsTime` from modifying `t_starttransfer` when invoked with `TIMER_STARTTRANSFER` more than once during a single request. When a redirect occurs, this is considered a new request and `t_starttransfer` can be updated to reflect the `t_starttransfer` time of the redirect request. Closes #1616 Bug: https://github.com/curl/curl/pull/1602#issuecomment-310267370
* includes: remove curl/curlbuild.h and curl/curlrules.hDaniel Stenberg2017-06-142-10/+4
| | | | | | | | Rely entirely on curl/system.h now. Introduced in Aug 2008 with commit 14240e9e109f. Now gone. Fixes #1456
* dedotdot: fixed output for ".." and "." only inputDaniel Stenberg2017-06-031-1/+8
| | | | | | | Found when updating test 1395, which I did to increase test coverage of this source file... Closes #1535
* tests: fix -Wcast-qual warningsMarcel Raad2017-05-052-4/+5
| | | | Avoid casting string literals to non-const char *.
* unit1305: fix compiler warningMarcel Raad2017-05-051-5/+2
| | | | calloc and ai_addrlen expect different (usually unsigned) types.
* unit1606: do not print/access bufferDaniel Stenberg2017-05-011-1/+0
| | | | It was a wrong assumption that it could do that!
* tests: declare TU-local variables staticMarcel Raad2017-05-012-2/+2
| | | | | This fixes missing-variable-declarations warnings when building with clang.
* unit1604: fixed indentationDan Fandrich2017-04-301-12/+12
|
* unit1604: fixed compilation under Windows, broken in the previous commitDan Fandrich2017-04-301-14/+19
|
* tests: fixed OOM handling of unit tests to abort testDan Fandrich2017-04-304-4/+6
| | | | It's dangerous to continue to run the test when a memory alloc fails.
* llist: no longer uses mallocDaniel Stenberg2017-04-221-72/+57
| | | | | | | | | | | | The 'list element' struct now has to be within the data that is being added to the list. Removes 16.6% (tiny) mallocs from a simple HTTP transfer. (96 => 80) Also removed return codes since the llist functions can't fail now. Test 1300 updated accordingly. Closes #1435
* unit1303: fix compiler warningMarcel Raad2017-04-161-2/+2
| | | | | | | MinGW-w64 complains: warning: conversion to 'long int' from 'time_t {aka long long int}' may alter its value [-Wconversion] Fix this by using the correct type.