aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
AgeCommit message (Collapse)Author
2016-02-05tool_doswin: Improve sanitization processingJay Satiro
- Add unit test 1604 to test the sanitize_file_name function. - Use -DCURL_STATICLIB when building libcurltool for unit testing. - Better detection of reserved DOS device names. - New flags to modify sanitize behavior: SANITIZE_ALLOW_COLONS: Allow colons SANITIZE_ALLOW_PATH: Allow path separators and colons SANITIZE_ALLOW_RESERVED: Allow reserved device names SANITIZE_ALLOW_TRUNCATE: Allow truncating a long filename - Restore sanitization of banned characters from user-specified outfile. Prior to this commit sanitization of a user-specified outfile was temporarily disabled in 2b6dadc because there was no way to allow path separators and colons through while replacing other banned characters. Now in such a case we call the sanitize function with SANITIZE_ALLOW_PATH which allows path separators and colons to pass through. Closes https://github.com/curl/curl/issues/624 Reported-by: Octavio Schroeder
2016-02-03URLs: change all http:// URLs to https://Daniel Stenberg
2016-02-02dotdot: allow an empty input string tooDaniel Stenberg
It isn't used by the code in current conditions but for safety it seems sensible to at least not crash on such input. Extended unit test 1395 to verify this too as well as a plain "/" input.
2015-11-12unit1603: Demote hash mismatch failure to a warningdfandrich
The hashes can vary between architectures (e.g. Sparc differs from x86_64). This is not a fatal problem but just reduces the coverage of these white-box tests, as the assumptions about into which hash bucket each key falls are no longer valid.
2015-11-12unit1603: Added unit tests for hash functionsdfandrich
2015-11-12unit1602: Fixed failure in torture testdfandrich
2015-10-16test1601: fix compilation with --enable-debug and --disable-crypto-authDan Fandrich
2015-05-18hostip: fix unintended destruction of hash tableAnthony Avina
.. and added unit1602 for hash.c
2015-05-12hostcache: made all host caches use structs, not pointersDaniel Stenberg
This avoids unnecessary dynamic allocs and as this also removed the last users of *hash_alloc() and *hash_destroy(), those two functions are now removed.
2015-04-22tests/unit/.gitignore: hide unit1601 and above, tooKamil Dudka
2015-04-03fix refreshing of obsolete dns cache entriesStefan Bühler
- cache entries must be also refreshed when they are in use - have the cache count as inuse reference too, freeing timestamp == 0 special value - use timestamp == 0 for CURLOPT_RESOLVE entries which don't get refreshed - remove CURLOPT_RESOLVE special inuse reference (timestamp == 0 will prevent refresh) - fix Curl_hostcache_clean - CURLOPT_RESOLVE entries don't have a special reference anymore, and it would also release non CURLOPT_RESOLVE references - fix locking in Curl_hostcache_clean - fix unit1305.c: hash now keeps a reference, need to set inuse = 1
2015-03-16Bug #149: Deletion of unnecessary checks before calls of the function "free"Markus Elfring
The function "free" is documented in the way that no action shall occur for a passed null pointer. It is therefore not needed that a function caller repeats a corresponding check. http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first This issue was fixed by using the software Coccinelle 1.0.0-rc24. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2015-03-05openssl: remove all uses of USE_SSLEAYDaniel Stenberg
SSLeay was the name of the library that was subsequently turned into OpenSSL many moons ago (1999). curl does not work with the old SSLeay library since years. This is now reflected by only using USE_OPENSSL in code that depends on OpenSSL.
2015-02-04unit1600: Fix compilation when NTLM is disabledDan Fandrich
2015-02-03unit1601: MD5 unit testsDaniel Stenberg
2015-02-03unit1600: unit test for Curl_ntlm_core_mk_nt_hashDaniel Stenberg
2015-02-03unit1600: NTLM unit testDaniel Stenberg
2014-10-13vtls: remove QsoSSLPatrick Monnerat
2014-07-25Curl_base64url_encode: unit-tested in 1302Daniel Stenberg
2014-07-12Fixed some "statement not reached" warningsDan Fandrich
2014-05-15timers: fix timer regression involving redirects / reconnectsDaniel Stenberg
In commit 0b3750b5c23c25f (released in 7.36.0) we fixed a timeout issue but instead broke the timings. To fix this, I introduce a new timestamp to use for the timeouts and restored the previous timestamp and timestamp position so that the old timer functionality is restored. In addition to that, that change also broke connection timeouts for when more than one connect was used (as it would then count the total time from the first connect and not for the most recent one). Now Curl_timeleft() has been modified so that it checks against different start times depending on which timeout it checks. Test 1303 is updated accordingly. Bug: http://curl.haxx.se/mail/lib-2014-05/0147.html Reported-by: Ryan Braud
2014-05-04mprintf: allow %.s with data not being zero terminatedDaniel Stenberg
If the precision is indeed shorter than the string, don't strlen() to find the end because that's not how the precision operator works. I also added a unit test for curl_msnprintf to make sure this works and that the fix doesn't a few other basic use cases. I found a POSIX compliance problem that I marked TODO in the unit test, and I figure we need to add more tests in the future. Reported-by: Török Edwin
2014-04-28copyright: Updated following recent editsSteve Holme
2014-04-29Added a few more const where possibleDan Fandrich
2014-04-28unit1395: Fixed null pointer dereference on torture testDan Fandrich
2014-03-26test1397: Fixed compilation with some SSL backendsDan Fandrich
The test is only valid when one of four SSL backends is in use, and must otherwise return success.
2014-03-25test1397: unit test for certificate name wildcard handlingRichard J. Moore
2014-01-28unit1304: make the test pass the OOM torture testsDan Fandrich
2014-01-28unit1396: make the test pass the OOM torture testsDan Fandrich
2014-01-03unittests: do not include curl_memory.hMarc Hoersken
memdebug.h already contains all required definitions and including curl_memory.h causes errors like the following: tests/unit/unit1394.c:119: undefined reference to `Curl_cfree' tests/unit/unit1394.c:120: undefined reference to `Curl_cfree'
2013-12-01base64: Extended validation to look for invalid charactersSteve Holme
Extended the basic validation in commit e17c1b25bc33eb to return a failure when invalid base64 characters are included.
2013-10-30base64: Added basic validation to base64 input string when decodingSteve Holme
A base64 string should be a multiple of 4 characters in length, not contain any more than 2 padding characters and only contain padding characters at the end of string. For example: Y3VybA== Strings such as the following are considered invalid: Y= - Invalid length Y== - Invalid length Y=== - More than two padding characters Y=x= - Padding character contained within string
2013-08-29unit1304: include memdebug and free everything correctlyDaniel Stenberg
2013-08-20netrc: handle longer username and passwordJonathan Nieder
libcurl truncates usernames and passwords it reads from .netrc to LOGINSIZE and PASSWORDSIZE (64) characters without any indication to the user, to ensure the values returned from Curl_parsenetrc fit in a caller-provided buffer. Fix the interface by passing back dynamically allocated buffers allocated to fit the user's input. The parser still relies on a 256-character buffer to read each line, though. So now you can include an ~246-character password in your .netrc, instead of the previous limit of 63 characters. Reported-by: Colby Ranger
2013-06-22dotdot: introducing dot file path cleanupDaniel Stenberg
RFC3986 details how a path part passed in as part of a URI should be "cleaned" from dot sequences before getting used. The described algorithm is now implemented in lib/dotdot.c with the accompanied test case in test 1395. Bug: http://curl.haxx.se/bug/view.cgi?id=1200 Reported-by: Alex Vinnik
2013-06-22unit1396: unit tests to verify curl_easy_(un)escapeDaniel Stenberg
2013-05-06build: fixed unit1394 for debug and metlink buildsDaniel Stenberg
2013-05-06unit1394.c: plug the curl tool unit test inKamil Dudka
2013-05-06unit1394.c: basis of a unit test for parse_cert_parameter()Jared Jennings
2013-05-06src/Makefile.am: build static lib for unit tests if enabledKamil Dudka
2013-03-15unit1330.c: fix dateYang Tse
2013-03-15tests: add #96 #558 and #1330Yang Tse
These verfy that the 'memory tracking' subsystem is actually doing its job when using curl tool (#96), a test in libtest (#558) and also a unit test (#1330), in order to prevent regressions in this functionallity.
2013-03-12curl.h: stricter CURL_EXTERN linkage decorations logicYang Tse
No API change involved. Info: http://curl.haxx.se/mail/lib-2013-02/0234.html
2013-01-20Makefile.inc: fix $(top_srcdir) not allowed in _SOURCES variablesYang Tse
2013-01-15build: use per-target '_CPPFLAGS' for those currently using defaultYang Tse
Automake documents that doing this will make it choose a different name for intermediate object files even when sharing source files across targets of same Makefile.am. Up to automake 1.13.1 target's intermediate object files were placed in the build subdirectory of the target. We depended on this, probably undocumented behavior, to achieve same behavior as if a per-target flag had been specified when building targets that actually belong to different Makefile.am files. It seems automake 1.13.2 is going to break behavior mentioned above. So, lets use a documented behavior in order to achieve same purpose, across automake versions, no matter where automake wishes to place intermediate object files. Our build targets that already were using a per-target '_CFLAGS' or '_CPPFLAGS' need no 'fixing', these were already 'fixed'. The only Makefile.am or Makefile.in files in libcurl's source tree touched by this 'fix' are tests/libtest/Makefile.inc and tests/unit/Makefile.inc.
2013-01-09build: fix circular header inclusion with other packagesYang Tse
This commit renames lib/setup.h to lib/curl_setup.h and renames lib/setup_once.h to lib/curl_setup_once.h. Removes the need and usage of a header inclusion guard foreign to libcurl. [1] Removes the need and presence of an alarming notice we carried in old setup_once.h [2] ---------------------------------------- 1 - lib/setup_once.h used __SETUP_ONCE_H macro as header inclusion guard up to commit ec691ca3 which changed this to HEADER_CURL_SETUP_ONCE_H, this single inclusion guard is enough to ensure that inclusion of lib/setup_once.h done from lib/setup.h is only done once. Additionally lib/setup.h has always used __SETUP_ONCE_H macro to protect inclusion of setup_once.h even after commit ec691ca3, this was to avoid a circular header inclusion triggered when building a c-ares enabled version with c-ares sources available which also has a setup_once.h header. Commit ec691ca3 exposes the real nature of __SETUP_ONCE_H usage in lib/setup.h, it is a header inclusion guard foreign to libcurl belonging to c-ares's setup_once.h The renaming this commit does, fixes the circular header inclusion, and as such removes the need and usage of a header inclusion guard foreign to libcurl. Macro __SETUP_ONCE_H no longer used in libcurl. 2 - Due to the circular interdependency of old lib/setup_once.h and the c-ares setup_once.h header, old file lib/setup_once.h has carried back from 2006 up to now days an alarming and prominent notice about the need of keeping libcurl's and c-ares's setup_once.h in sync. Given that this commit fixes the circular interdependency, the need and presence of mentioned notice is removed. All mentioned interdependencies come back from now old days when the c-ares project lived inside a curl subdirectory. This commit removes last traces of such fact.
2013-01-06Revert changes relative to lib/*.[ch] recent renamingYang Tse
This reverts renaming and usage of lib/*.h header files done 28-12-2012, reverting 2 commits: f871de0... build: make use of 76 lib/*.h renamed files ffd8e12... build: rename 76 lib/*.h files This also reverts removal of redundant include guard (redundant thanks to changes in above commits) done 2-12-2013, reverting 1 commit: c087374... curl_setup.h: remove redundant include guard This also reverts renaming and usage of lib/*.c source files done 3-12-2013, reverting 3 commits: 13606bb... build: make use of 93 lib/*.c renamed files 5b6e792... build: rename 93 lib/*.c files 7d83dff... build: commit 13606bbfde follow-up 1 Start of related discussion thread: http://curl.haxx.se/mail/lib-2013-01/0012.html Asking for confirmation on pushing this revertion commit: http://curl.haxx.se/mail/lib-2013-01/0048.html Confirmation summary: http://curl.haxx.se/mail/lib-2013-01/0079.html NOTICE: The list of 2 files that have been modified by other intermixed commits, while renamed, and also by at least one of the 6 commits this one reverts follows below. These 2 files will exhibit a hole in history unless git's '--follow' option is used when viewing logs. lib/curl_imap.h lib/curl_smtp.h
2012-12-28build: make use of 76 lib/*.h renamed filesYang Tse
76 private header files renamed to use our standard naming scheme. This change affects 322 files in libcurl's source tree.
2012-12-04build: explain current role of LIBS in our Makefile.am filesYang Tse
BLANK_AT_MAKETIME may be used in our Makefile.am files to blank LIBS variable used in generated makefile at makefile processing time. Doing this functionally prevents LIBS from being used for all link targets in given makefile.
2012-11-06uniformly use AM_CPPFLAGS, avoid deprecated INCLUDESDave Reisner
Since automake 1.12.4, the warnings are issued on running automake: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') Avoid INCLUDES and roll these flags into AM_CPPFLAGS. Compile tested on: Ubuntu 10.04 (automake 1:1.11.1-1) Ubuntu 12.04 (automake 1:1.11.3-1ubuntu2) Arch Linux (automake 1.12.4)