summaryrefslogtreecommitdiff
path: root/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* conncache: various concept cleanupsbagder/conncache-cleanupDaniel Stenberg2020-04-271-5/+1
| | | | | | | | | | | | | | | | More connection cache accesses are protected by locks. CONNCACHE_* is a beter prefix for the connection cache lock macros. Curl_attach_connnection: now called as soon as there's a connection struct available and before the connection is added to the connection cache. Curl_disconnect: now assumes that the connection is already removed from the connection cache. Ref: #4915 Closes #5009
* src: Remove C99 constructs to ensure C89 complianceTom2020-04-191-2/+3
| | | | | | | | | This fixes the error: 'for' loop initial declaration used outside C99 mode by declaring the loop increment variable in the beginning of the block instead of inside the for loop. Fixes #5254 Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
* cleanup: insert newline after if() conditionsDaniel Stenberg2020-03-301-2/+4
| | | | | Our code style mandates we put the conditional block on a separate line. These mistakes are now detected by the updated checksrc.
* copyright: fix out-of-date copyright ranges and missing headersDaniel Stenberg2020-03-248-7/+28
| | | | | | | | | Reported by the new script 'scripts/copyright.pl'. The script has a regex whitelist for the files that don't need copyright headers. Removed three (mostly usesless) README files from docs/ Closes #5141
* cleanup: fix some text/comment typosViktor Szakats2020-03-121-1/+1
| | | | Closes #5087
* unit1612: fixed the inclusion and compilation of the HMAC unit testSteve Holme2020-03-062-2/+3
| | | | | | | | | Follow up to 3f74e5e6 to fix: - A typo in Makefile.inc where unit1611 was used instead - Some compilation issues in unit1612.c Closes #5024
* unit1651: Fixed conversion compilation warningSteve Holme2020-03-011-2/+2
| | | | | | | 371:17: warning: conversion to 'unsigned char' from 'int' may alter its value [-Wconversion] Closes #5008
* hmac: Added a unit test for the HMAC hash generationSteve Holme2020-02-242-1/+69
| | | | Closes #4973
* tests: Added a unit test for MD4 digest generationSteve Holme2020-02-232-1/+62
| | | | Closes #4970
* md5/sha256: Updated the functions to allow non-string data to be hashedSteve Holme2020-02-232-11/+13
|
* tests: Added a unit test for SHA256 digest generationSteve Holme2020-02-222-1/+87
| | | | | | Follow up to 2b5b37c. Closes #4968
* altsvc: make saving the cache an atomic operationDaniel Stenberg2020-02-181-2/+2
| | | | | | | | ... by writing the file to temp name then rename to the final when done. Assisted-by: Jay Satiro Fixes #4936 Closes #4942
* llist: removed unused Curl_llist_move()Daniel Stenberg2020-01-241-51/+1
| | | | | | (and the corresponding unit test) Closes #4842
* tests: make sure checksrc runs on header files tooDaniel Stenberg2019-12-161-1/+1
|
* tests: fix build with `CURL_DISABLE_DOH`Marcel Raad2019-12-132-2/+14
| | | | Closes https://github.com/curl/curl/pull/4692
* unit1620: fix bad free in OOMDaniel Stenberg2019-12-131-0/+2
| | | | Closes #4709
* unit1609: fix mem-leak in OOMDaniel Stenberg2019-12-131-9/+20
| | | | Closes #4709
* unit1607: fix mem-leak in OOMDaniel Stenberg2019-12-131-12/+18
| | | | Closes #4709
* build: Disable Visual Studio warning "conditional expression is constant"Jay Satiro2019-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Disable warning C4127 "conditional expression is constant" globally in curl_setup.h for when building with Microsoft's compiler. This mainly affects building with the Visual Studio project files found in the projects dir. Prior to this change the cmake and winbuild build systems already disabled 4127 globally for when building with Microsoft's compiler. Also, 4127 was already disabled for all build systems in the limited circumstance of the WHILE_FALSE macro which disabled the warning specifically for while(0). This commit removes the WHILE_FALSE macro and all other cruft in favor of disabling globally in curl_setup. Background: We have various macros that cause 0 or 1 to be evaluated, which would cause warning C4127 in Visual Studio. For example this causes it: #define Curl_resolver_asynch() 1 Full behavior is not clearly defined and inconsistent across versions. However it is documented that since VS 2015 Update 3 Microsoft has addressed this somewhat but not entirely, not warning on while(true) for example. Prior to this change some C4127 warnings occurred when I built with Visual Studio using the generated projects in the projects dir. Closes https://github.com/curl/curl/pull/4658
* doh: improced both encoding and decodingNiall2019-11-161-27/+91
| | | | | | | | | | | Improved estimation of expected_len and updated related comments; increased strictness of QNAME-encoding, adding error detection for empty labels and names longer than the overall limit; avoided treating DNAME as unexpected; updated unit test 1655 with more thorough set of proofs and tests Closes #4598
* copyrights: update all copyright notices to 2019 on files changed this yearVilhelm Prytz2019-11-023-3/+3
| | | | Closes #4547
* url: make Curl_close() NULLify the pointer tooDaniel Stenberg2019-10-301-2/+2
| | | | | | | This is the common pattern used in the code and by a unified approach we avoid mistakes. Closes #4534
* altsvc: accept quoted ma and persist valuesDaniel Stenberg2019-09-301-2/+11
| | | | | | As mandated by the spec. Test 1654 is extended to verify. Closes #4443
* tests: fix narrowing conversion warningsMarcel Raad2019-09-272-3/+3
| | | | | | | `timediff_t` is 64 bits wide also on 32-bit systems since commit b1616dad8f0. Closes https://github.com/curl/curl/pull/4415
* unit1655: make it C90 compliantDaniel Stenberg2019-09-161-52/+55
| | | | | | Unclear why this was not detected in the CI. Follow-up to b7666027296a
* doh: fix (harmless) buffer overrunPaul Dreik2019-09-154-2/+121
| | | | | | | | Added unit test case 1655 to verify. Close #4352 the code correctly finds the flaws in the old code, if one temporarily restores doh.c to the old version.
* Curl_addr2string: take an addrlen argument tooDaniel Stenberg2019-08-312-2/+2
| | | | | | | | | | | This allows the function to figure out if a unix domain socket has a file name or not associated with it! When a socket is created with socketpair(), as done in the fuzzer testing, the path struct member is uninitialized and must not be accessed. Bug: https://crbug.com/oss-fuzz/16699 Closes #4283
* http3: make connection reuse workDaniel Stenberg2019-08-092-13/+5
| | | | Closes #4204
* alt-svc: add protocol version selection maskingDaniel Stenberg2019-08-081-1/+1
| | | | | | | | | | | So that users can mask in/out specific HTTP versions when Alt-Svc is used. - Removed "h2c" and updated test case accordingly - Changed how the altsvc struct is laid out - Added ifdefs to make the unittest run even in a quiche-tree Closes #4201
* unit1654: cleanup on memory failureDaniel Stenberg2019-06-131-1/+3
| | | | | | | | ... to make it handle torture tests properly. Reported-by: Marcel Raad Fixes #4021 Closes #4022
* wolfssl: refer to it as wolfSSL onlyDaniel Stenberg2019-06-101-1/+1
| | | | | | | | | | Remove support for, references to and use of "cyaSSL" from the source and docs. wolfSSL is the current name and there's no point in keeping references to ancient history. Assisted-by: Daniel Gustafsson Closes #3903
* cleanup: remove FIXME and TODO commentsDaniel Stenberg2019-05-162-7/+2
| | | | | | | | | They serve very little purpose and mostly just add noise. Most of them have been around for a very long time. I read them all before removing or rephrasing them. Ref: #3876 Closes #3883
* urlapi: strip off scope id from numerical IPv6 addressesDaniel Stenberg2019-05-031-2/+2
| | | | | | | | | | ... to make the host name "usable". Store the scope id and put it back when extracting a URL out of it. Also makes curl_url_set() syntax check CURLUPART_HOST. Fixes #3817 Closes #3822
* tests: Run global cleanup at end of testsDaniel Gustafsson2019-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Make sure to run curl_global_cleanup() when shutting down the test suite to release any resources allocated in the SSL setup. This is clearly visible when running tests with PolarSSL where the thread lock calloc() memory which isn't released when not running cleanup. Below is an excerpt from the autobuild logs: ==12368== 96 bytes in 1 blocks are possibly lost in loss record 1 of 2 ==12368== at 0x4837B65: calloc (vg_replace_malloc.c:752) ==12368== by 0x11A76E: curl_dbg_calloc (memdebug.c:205) ==12368== by 0x145CDF: Curl_polarsslthreadlock_thread_setup (polarssl_threadlock.c:54) ==12368== by 0x145B37: Curl_polarssl_init (polarssl.c:865) ==12368== by 0x14129D: Curl_ssl_init (vtls.c:171) ==12368== by 0x118B4C: global_init (easy.c:158) ==12368== by 0x118BF5: curl_global_init (easy.c:221) ==12368== by 0x118D0B: curl_easy_init (easy.c:299) ==12368== by 0x114E96: test (lib1906.c:32) ==12368== by 0x115495: main (first.c:174) Closes #3783 Reviewed-by: Marcel Raad <Marcel.Raad@teamviewer.com> Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* CURLOPT_DNS_USE_GLOBAL_CACHE: removeDaniel Stenberg2019-04-112-44/+29
| | | | | | | | Remove the code too. The functionality has been disabled in code since 7.62.0. Setting this option will from now on simply be ignored and have no function. Closes #3654
* xattr: skip unittest on unsupported platformsDaniel Gustafsson2019-04-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | The stripcredentials unittest fails to compile on platforms without xattr support, for example the Solaris member in the buildfarm which fails with the following: CC unit1621-unit1621.o CC ../libtest/unit1621-first.o CCLD unit1621 Undefined first referenced symbol in file stripcredentials unit1621-unit1621.o goto problem 2 ld: fatal: symbol referencing errors. No output written to .libs/unit1621 collect2: error: ld returned 1 exit status gmake[2]: *** [Makefile:996: unit1621] Error 1 Fix by excluding the test on such platforms by using the reverse logic from where stripcredentials() is defined. Closes #3759 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* makefile: make checksrc and hugefile commands "silent"Daniel Stenberg2019-03-141-2/+7
| | | | | | | ... to match the style already used for compiling, linking etc. Acknowledges 'make V=1' to enable verbose. Closes #3681
* tests: fix multiple may be used uninitialized warningsDaniel Stenberg2019-03-051-2/+2
|
* alt-svc: the libcurl bitsDaniel Stenberg2019-03-032-1/+128
|
* unit1651: survive curl_easy_init() failsDaniel Stenberg2019-02-191-1/+3
|
* unit1307: just fail without FTP supportMarcel Raad2019-02-151-9/+22
| | | | | | | | I missed to check this in with commit 71786c0505926aaf7e9b2477b2fb7ee16a915ec6, which only disabled the test. This fixes the actual linker error. Closes https://github.com/curl/curl/pull/3568
* cleanup: make local functions staticDaniel Stenberg2019-02-103-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | urlapi: turn three local-only functions into statics conncache: make conncache_find_first_connection static multi: make detach_connnection static connect: make getaddressinfo static curl_ntlm_core: make hmac_md5 static http2: make two functions static http: make http_setup_conn static connect: make tcpnodelay static tests: make UNITTEST a thing to mark functions with, so they can be static for normal builds and non-static for unit test builds ... and mark Curl_shuffle_addr accordingly. url: make up_free static setopt: make vsetopt static curl_endian: make write32_le static rtsp: make rtsp_connisdead static warnless: remove unused functions memdebug: remove one unused function, made another static
* 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