summaryrefslogtreecommitdiff
path: root/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* unit1653: make it survive torture testsDaniel Stenberg2019-01-281-16/+63
|
* urldata: rename easy_conn to just connDaniel Stenberg2019-01-111-4/+4
| | | | | | | | | | | | | | | We use "conn" everywhere to be a pointer to the connection. Introduces two functions that "attaches" and "detaches" the connection to and from the transfer. Going forward, we should favour using "data->conn" (since a transfer always only has a single connection or none at all) to "conn->data" (since a connection can have none, one or many transfers associated with it and updating conn->data to be correct is error prone and a frequent reason for internal issues). Closes #3442
* xattr: strip credentials from any URL that is storedDaniel Stenberg2019-01-102-1/+94
| | | | | | | | | Both user and password are cleared uncondtitionally. Added unit test 1621 to verify. Fixes #3423 Closes #3433
* printf: fix format specifiersRikard Falkeborn2019-01-041-7/+7
| | | | Closes #3426
* urlapi: fix parsing ipv6 with zone indexDaniel Gustafsson2018-12-301-0/+8
| | | | | | | | | | | | | | The previous fix for parsing IPv6 URLs with a zone index was a paddle short for URLs without an explicit port. This patch fixes that case and adds a unit test case. This bug was highlighted by issue #3408, and while it's not the full fix for the problem there it is an isolated bug that should be fixed regardless. Closes #3411 Reported-by: GitYuanQu on github Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* urlapi: Fix port parsing of eol colonDaniel Gustafsson2018-12-121-0/+8
| | | | | | | | | A URL with a single colon without a portnumber should use the default port, discarding the colon. Fix, add a testcase and also do little bit of comment wordsmithing. Closes #3365 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* tests: add urlapi unittestDaniel Gustafsson2018-12-112-1/+133
| | | | | | | | | | This adds a new unittest intended to cover the internal functions in the urlapi code, starting with parse_port(). In order to avoid name collisions in debug builds, parse_port() is renamed Curl_parse_port() since it will be exported. Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com>
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-235-23/+27
| | | | | | | | | | | The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
* netrc: don't ignore the login name specified with "--user"Michael Kaufmann2018-11-051-13/+38
| | | | | | | | | | | | - for "--netrc", don't ignore the login/password specified with "--user", only ignore the login/password in the URL. This restores the netrc behaviour of curl 7.61.1 and earlier. - fix the documentation of CURL_NETRC_REQUIRED - improve the detection of login/password changes when reading .netrc - don't read .netrc if both login and password are already set Fixes #3213 Closes #3224
* unittest: make 1652 stable across collationsDaniel Gustafsson2018-11-051-2/+2
| | | | | | | | | | | | The previous coding used a format string whose output depended on the current locale of the environment running the test. Since the gist of the test is to have a format string, with the actual formatting being less important, switch to a more stable formatstring with decimals. Reported-by: Marcel Raad Closes #3234 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com>
* infof: clearly indicate truncationDaniel Gustafsson2018-11-032-1/+137
| | | | | | | | | | | | | | | | | | The internal buffer in infof() is limited to 2048 bytes of payload plus an additional byte for NULL termination. Servers with very long error messages can however cause truncation of the string, which currently isn't very clear, and leads to badly formatted output. This appends a "...\n" (or just "..." in case the format didn't with a newline char) marker to the end of the string to clearly show that it has been truncated. Also include a unittest covering infof() to try and catch any bugs introduced in this quite important function. Closes #3216 Reviewed-by: Daniel Stenberg <daniel@haxx.se> Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com>
* axtls: removedDaniel Stenberg2018-11-011-2/+2
| | | | | | | | | | As has been outlined in the DEPRECATE.md document, the axTLS code has been disabled for 6 months and is hereby removed. Use a better supported TLS library! Assisted-by: Daniel Gustafsson Closes #3194
* unit1650: fix "null pointer passed as argument 1 to memcmp"Daniel Stenberg2018-10-291-1/+1
| | | | | | Detected by UndefinedBehaviorSanitizer Closes #3187
* unit1300: fix stack-use-after-scope AddressSanitizer warningDaniel Stenberg2018-10-291-3/+4
| | | | Closes #3186
* test1651: unit test Curl_extract_certinfo()Daniel Stenberg2018-10-272-1/+390
| | | | The version used for Gskit, NSS, GnuTLS, WolfSSL and schannel.
* doh: keep the IPv4 address in (original) network byte orderDaniel Stenberg2018-10-051-8/+8
| | | | | | | | Ideally this will fix the reversed order shown in SPARC tests: resp 8: Expected 127.0.0.1 got 1.0.0.127 Closes #3091
* test1650: make it depend on http/2Daniel Stenberg2018-10-011-0/+11
| | | | | | | Follow-up to 570008c99da0ccbb as it gets link errors. Reported-by: Michael Kaufmann Closes #3068
* 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