summaryrefslogtreecommitdiff
path: root/tests/unit
Commit message (Collapse)AuthorAgeFilesLines
* scripts/copyright: .muse is .lift nowDaniel Stenberg2021-09-282-2/+2
| | | | And update 5 files with old copyright year range
* cleanup: constify unmodified static structsRikard Falkeborn2021-09-232-3/+3
| | | | | | | Constify a number of static structs that are never modified. Make them const to show this. Closes #7759
* msnprintf: return number of printed characters excluding null byteDaniel Stenberg2021-07-082-7/+7
| | | | | | | | ... even when the output is "capped" by the maximum length argument. Clarified in the docs. Closes #7361
* infof: remove newline from format strings, always append itDaniel Stenberg2021-07-071-14/+18
| | | | | | | | | | | | | | | | - the data needs to be "line-based" anyway since it's also passed to the debug callback/application - it makes infof() work like failf() and consistency is good - there's an assert that triggers on newlines in the format string - Also removes a few instances of "..." - Removes the code that would append "..." to the end of the data *iff* it was truncated in infof() Closes #7357
* metalink: removeDaniel Stenberg2021-06-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Warning: this will make existing curl command lines that use metalink to stop working. Reasons for removal: 1. We've found several security problems and issues involving the metalink support in curl. The issues are not detailed here. When working on those, it become apparent to the team that several of the problems are due to the system design, metalink library API and what the metalink RFC says. They are very hard to fix on the curl side only. 2. The metalink usage with curl was only very briefly documented and was not following the "normal" curl usage pattern in several ways, making it surprising and non-intuitive which could lead to further security issues. 3. The metalink library was last updated 6 years ago and wasn't so active the years before that either. An unmaintained library means there's a security problem waiting to happen. This is probably reason enough. 4. Metalink requires an XML parsing library, which is complex code (even the smaller alternatives) and to this day often gets security updates. 5. Metalink is not a widely used curl feature. In the 2020 curl user survey, only 1.4% of the responders said that they'd are using it. In 2021 that number was 1.2%. Searching the web also show very few traces of it being used, even with other tools. 6. The torrent format and associated technology clearly won for downloading large files from multiple sources in parallel. Cloes #7176
* copyright: update copyright year ranges to 2021Daniel Stenberg2021-05-261-1/+1
|
* tidy-up: make conditional checks more consistentDaniel Stenberg2021-04-222-3/+3
| | | | | | ... remove '== NULL' and '!= 0' Closes #6912
* bufref: buffer reference supportPatrick Monnerat2021-04-222-2/+118
| | | | | | | | | | | A struct bufref holds a buffer pointer, a data size and a destructor. When freed or its contents are changed, the previous buffer is implicitly released by the associated destructor. The data size, although not used internally, allows binary data support. A unit test checks its handling methods: test 1661 Closes #6654
* Revert "cmake: make libcurl library output name configurable"Daniel Stenberg2021-04-211-1/+1
| | | | | | | | | This reverts commit 1cba36d2166c396f987eea587cf92671b27acb92. CMake provides properties that can be set on a target to rename the output artifact without changing the name of a target. Ref: #6899
* cmake: make libcurl library output name configurableRalph Langendam2021-04-211-1/+1
| | | | Closes #6899
* hsts: enable by defaultDaniel Stenberg2021-04-191-1/+1
| | | | | | No longer considered experimental. Closes #6700
* copyright: update copyright year ranges to 2021Daniel Stenberg2021-03-272-2/+2
| | | | | Reviewed-by: Emil Engler Closes #6802
* lib: use int type for more port variablesJay Satiro2021-02-092-2/+2
| | | | | | | This is a follow-up to 764c6bd. Prior to that change port variables were usually type long. Closes https://github.com/curl/curl/pull/6553
* copyright: fix missing year (range) updatesDaniel Stenberg2021-01-291-1/+1
|
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-8/+3
| | | | | | | | | | | | | | | | | | | | | ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425
* lib/unit tests: add missing curl_global_cleanup() callsDaniel Stenberg2021-01-0610-18/+39
|
* tests/unit: fix empty statements with no effectDaniel Stenberg2020-12-291-37/+47
| | | | ... by making macros use "do {} while(0)"
* dns: extend CURLOPT_RESOLVE syntax for adding non-permanent entriesPaul Groke2020-12-291-14/+28
| | | | | | | | | | | | | | | | | | Extend the syntax of CURLOPT_RESOLVE strings: allow using a '+' prefix (similar to the existing '-' prefix for removing entries) to add DNS cache entries that will time out just like entries that are added by libcurl itself. Append " (non-permanent)" to info log message in case a non-permanent entry is added. Adjust relevant comments to reflect the new behavior. Adjust documentation. Extend unit1607 to test the new functionality. Closes #6294
* urlapi: don't accept blank port number field without schemeDaniel Stenberg2020-12-071-12/+28
| | | | | | | | | | ... as it makes the URL parser accept "very-long-hostname://" as a valid host name and we don't want that. The parser now only accepts a blank (no digits) after the colon if the URL starts with a scheme. Reported-by: d4d on hackerone Closes #6283
* splay: rename Curl_splayremovebyaddr to Curl_splayremoveDaniel Stenberg2020-12-011-1/+1
| | | | | | | ... and remove the old unused proto for the old Curl_splayremove version. Closes #6269
* infof/failf calls: fix format specifiersRikard Falkeborn2020-11-241-1/+1
| | | | | | Update a few format specifiers to match what is being printed. Closes #6241
* copyright: fix year rangesDaniel Stenberg2020-11-0516-16/+16
| | | | Follow-up from 4d2f8006777
* curl.se: new homeDaniel Stenberg2020-11-0443-46/+46
| | | | Closes #6172
* hsts: add read/write callbacksDaniel Stenberg2020-11-031-7/+6
| | | | | | | | - read/write callback options - man pages for the 4 new setopts - test 1915 verifies the callbacks Closes #5896
* hsts: add support for Strict-Transport-SecurityDaniel Stenberg2020-11-032-1/+176
| | | | | | | | | | | | | | | | | | | | | | | | | - enable in the build (configure) - header parsing - host name lookup - unit tests for the above - CI build - CURL_VERSION_HSTS bit - curl_version_info support - curl -V output - curl-config --features - CURLOPT_HSTS_CTRL - man page for CURLOPT_HSTS_CTRL - curl --hsts (sets CURLOPT_HSTS_CTRL and works with --libcurl) - man page for --hsts - save cache to disk - load cache from disk - CURLOPT_HSTS - man page for CURLOPT_HSTS - added docs/HSTS.md - fixed --version docs - adjusted curl_easy_duphandle Closes #5896
* tests: add missing global_init/cleanup callsDaniel Stenberg2020-11-021-0/+2
| | | | | | | Without the cleanup call in these test files, the mbedTLS backend leaks memory. Closes #6156
* alt-svc: enable by defaultDaniel Stenberg2020-10-251-3/+2
| | | | | | | | Remove CURLALTSVC_IMMEDIATELY, which was never implemented/supported. alt-svc support in curl is no longer considered experimental Closes #5868
* checksrc: warn on empty line before open braceDaniel Stenberg2020-10-151-2/+0
| | | | | | ... and fix a few occurances Closes #6088
* tests/unit/README: convert to markdownDaniel Stenberg2020-09-302-27/+19
| | | | | | ... and add to dist! Closes #6028
* altsvc: clone setting in curl_easy_duphandlebagder/altsvc-duphandleDaniel Stenberg2020-09-061-2/+2
| | | | | | | | | | | | The cache content is not duplicated, like other caches, but the setting and specified file name are. Test 1908 is extended to verify this somewhat. Since the duplicated handle gets the same file name, the test unfortunately overwrites the same file twice (with different contents) which makes it hard to check automatically. Closes #5923
* hash: make it 'struct Curl_hash'Daniel Stenberg2020-09-023-5/+5
| | | | | | As internal global names should use captical C. Closes #5906
* llist: make it "struct Curl_llist"Daniel Stenberg2020-09-021-15/+15
| | | | | | As internal global names should use captical C. Closes #5906
* altsvc: remove the num field from the altsvc structDaniel Stenberg2020-06-121-8/+8
| | | | | | | | It was superfluous since we have the list.size alredy Reported-by: Jay Satiro Fixes #5553 Closes #5563
* Curl_addrinfo: use one malloc instead of threeDaniel Stenberg2020-06-081-13/+8
| | | | | | | | To reduce the amount of allocations needed for creating a Curl_addrinfo struct, make a single larger malloc instead of three separate smaller ones. Closes #5533
* unit1604.c: fix implicit conv from 'SANITIZEcode' to 'CURLcode'Marc Hoersken2020-05-301-3/+4
| | | | | | | | | | | | | GCC 10 warns about this with warning: implicit conversion from 'SANITIZEcode' to 'CURLcode' [-Wenum-conversion] Since 'expected_result' is not really of type 'CURLcode' and it is not exposed in any way, we can just use 'SANITIZEcode'. Reviewed-by: Daniel Stenberg Reviewed-by: Marcel Raad Closes #5476
* altsvc: fix parser for lines ending with CRLFDaniel Stenberg2020-05-251-9/+12
| | | | | | | | | | | | | Fixed the alt-svc parser to treat a newline as end of line. The unit tests in test 1654 were done without CRLF and thus didn't quite match the real world. Now they use CRLF as well. Reported-by: Peter Wu Assisted-by: Peter Wu Assisted-by: Jay Satiro Fixes #5445 Closes #5446
* source cleanup: remove all custom typedef structsDaniel Stenberg2020-05-152-5/+5
| | | | | | | | | | | - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
* checksrc: enhance the ASTERISKSPACE and update code accordinglyDaniel Stenberg2020-05-142-4/+4
| | | | | | | | Fine: "struct hello *world" Not fine: "struct hello* world" (and variations) Closes #5386
* CMake: fix runtests.pl with CMake, add new test targetsPeter Wu2020-05-121-12/+3
| | | | | | | | | | | | | | | | | | | * runtests.pl: - Fix out-of-tree build under CMake when srcdir is not set. Default srcdir to the location of runtests.pl. - Add a hack to allow CMake to use the TFLAGS option as documented in tests/README and used in scripts/travis/script.sh. * Bump CMake version to 3.2 for USES_TERMINAL, dropping Debian Jessie support (no one should care, it is already EOL.). * Remove CTest since it defines its own 'test' target with no tests since all unittests are already broken and not built by default. * Add new test targets based on the options from Makefile.am. Since new test targets are rarely added, I opted for duplicating the runtests.pl options as opposed to creating a new Makefile.inc file. Use top-level target names (test-x) instead of x-test since that is used by CI and others. Closes #5358
* CMake: do not build test programs by defaultPeter Wu2020-05-121-1/+2
| | | | | | | | The default target should only build libcurl and curl. Add a dedicated 'testdeps' target which will be used later when running tests. Note that unittests are currently broken in CMake and already excluded. Closes #5368
* dynbuf: introduce internal generic dynamic buffer functionsDaniel Stenberg2020-05-041-2/+3
| | | | | | | | | | | | | A common set of functions instead of many separate implementations for creating buffers that can grow when appending data to them. Existing functionality has been ported over. In my early basic testing, the total number of allocations seem at roughly the same amount as before, possibly a few less. See docs/DYNBUF.md for a description of the API. Closes #5300
* conncache: various concept cleanupsDaniel Stenberg2020-04-301-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
* headers: copyright range fixDaniel Stenberg2020-04-281-1/+1
|
* doh: Constify some input pointersRikard Falkeborn2020-04-281-4/+4
| | | | Closes #5306
* 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