aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
AgeCommit message (Collapse)Author
2018-09-05tests: add unit tests for url.cJim Fuller
Approved-by: Daniel Gustafsson Closes #2937
2018-08-08ssl: set engine implicitly when a PKCS#11 URI is providedAnderson Toshiyuki Sasaki
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
2018-07-17CMake: Update scripts to use consistent styleRuslan Baratov
Closes #2727 Reviewed-by: Sergei Nikulov
2018-06-11cppcheck: fix warningsMarian Klymov
- 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
2018-06-01CURLOPT_RESOLVE: always purge old entry firstAlibek.Jorajev
If there's an existing entry using the selected name. Closes #2622
2018-06-01fnmatch: use the system one if availableDaniel Stenberg
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
2018-05-28fnmatch: insist on escaped bracket to matchDaniel Stenberg
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
2018-05-21checksrc: make sure sizeof() is used *with* parenthesesDaniel Stenberg
... and unify the source code to adhere. Closes #2563
2018-05-18curl_fnmatch: only allow two asterisks for matchingDaniel Stenberg
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
2018-05-14tests: Fix format specifiersRikard Falkeborn
2018-04-08build: cleanup to fix clang warnings/errorsDaniel Stenberg
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
2018-03-17resolve: add CURLOPT_DNS_SHUFFLE_ADDRESSESRick Deist
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
2018-03-04build: get CFLAGS (including -werror) used for examples and testsDaniel Stenberg
... so that the CI and more detects compiler warnings/errors properly! Closes #2337
2018-03-02unit1307: proper cleanup on OOM to fix torture testsDan Fandrich
2018-02-28unit1309: fix warning on Windows x64Marcel Raad
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
2018-02-20CURLOPT_RESOLVE: Add support for multiple IP addresses per entryAnders Bakken
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
2018-01-31fnmatch: pattern syntax can no longer failPatrick Monnerat
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
2018-01-31fnmatch: accept an alphanum to be followed by a non-alphanum in char setPatrick Monnerat
Also be more tolerant about set pattern syntax. Update unit test 1307 accordingly. Bug: https://curl.haxx.se/mail/lib-2018-01/0114.html
2018-01-31fnmatch: do not match the empty string with a character setPatrick Monnerat
2018-01-17unit1307: test many wildcards tooDaniel Stenberg
2018-01-17ftp-wildcard: fix matching an empty string with "*[^a]"Daniel Stenberg
.... 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
2017-10-25time: rename Curl_tvnow to Curl_nowDaniel Stenberg
... 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
2017-10-25timediff: return timediff_t from the time diff functionsDaniel Stenberg
... 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
2017-09-11code style: use spaces around plusesDaniel Stenberg
2017-09-11code style: use spaces around equals signsDaniel Stenberg
2017-09-02mime: tests and examples.Patrick Monnerat
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.
2017-08-31unit1301: fix error message on first testDaniel Stenberg
2017-08-28unit1606: Fixed shadowed variable warningDan Fandrich
2017-08-26tests: Make sure libtests & unittests call curl_global_cleanup()Dan Fandrich
These were missed in commit c468c27b.
2017-08-15progress: Track total times following redirectsRyan Winograd
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
2017-08-08docs/comments: Update to secure URL versionsViktor Szakats
Closes #1741
2017-07-28test1323: verify curlx_tvdiffDaniel Stenberg
2017-07-28timeval: struct curltime is a struct timeval replacementDaniel Stenberg
... 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
2017-07-03unit1399: fix integer overflowRyan Winograd
Bug: #1616 Closes #1633
2017-07-01unit1399: add logging to time comparisonDaniel Stenberg
... to enable tracking down why autobuilds fail on this Bug: #1616
2017-06-30progress: prevent resetting t_starttransferRyan Winograd
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
2017-06-14includes: remove curl/curlbuild.h and curl/curlrules.hDaniel Stenberg
Rely entirely on curl/system.h now. Introduced in Aug 2008 with commit 14240e9e109f. Now gone. Fixes #1456
2017-06-03dedotdot: fixed output for ".." and "." only inputDaniel Stenberg
Found when updating test 1395, which I did to increase test coverage of this source file... Closes #1535
2017-05-05tests: fix -Wcast-qual warningsMarcel Raad
Avoid casting string literals to non-const char *.
2017-05-05unit1305: fix compiler warningMarcel Raad
calloc and ai_addrlen expect different (usually unsigned) types.
2017-05-01unit1606: do not print/access bufferDaniel Stenberg
It was a wrong assumption that it could do that!
2017-05-01tests: declare TU-local variables staticMarcel Raad
This fixes missing-variable-declarations warnings when building with clang.
2017-04-30unit1604: fixed indentationDan Fandrich
2017-04-30unit1604: fixed compilation under Windows, broken in the previous commitDan Fandrich
2017-04-30tests: fixed OOM handling of unit tests to abort testDan Fandrich
It's dangerous to continue to run the test when a memory alloc fails.
2017-04-22llist: no longer uses mallocDaniel Stenberg
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
2017-04-16unit1303: fix compiler warningMarcel Raad
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.
2017-04-06test1606: verify speedcheckDaniel Stenberg
2017-04-04tests: added test for Curl_splaygetbest to unit1309Dániel Bakai
This checks the new behavior of Curl_splaygetbest, so that the smallest node not larger than the key is removed, and FIFO behavior is kept even when there are multiple nodes with the same key. Closes #1358
2017-04-04multi: fix queueing of pending easy handlesDániel Bakai
Multi handles repeatedly invert the queue of pending easy handles when used with CURLMOPT_MAX_TOTAL_CONNECTIONS. This is caused by a multistep process involving Curl_splaygetbest and violates the FIFO property of the multi handle. This patch fixes this issue by redefining the "best" node in the context of timeouts as the "smallest not larger than now", and implementing the necessary data structure modifications to do this effectively, namely: - splay nodes with the same key are now stored in a doubly-linked circular list instead of a non-circular one to enable O(1) insertion to the tail of the list - Curl_splayinsert inserts nodes with the same key to the tail of the same list - in case of multiple nodes with the same key, the one on the head of the list gets selected