summaryrefslogtreecommitdiff
path: root/tests/libtest
Commit message (Collapse)AuthorAgeFilesLines
* lib1560: add tests for parsing URL with too long schemeDaniel Stenberg2019-05-201-0/+18
| | | | Ref: #3905
* urlapi: require a non-zero host name length when parsing URLDaniel Stenberg2019-05-141-0/+3
| | | | | | Updated test 1560 to verify. Closes #3880
* build: fix "clarify calculation precedence" warningsMarcel Raad2019-05-121-2/+2
| | | | | | | Codacy/CppCheck warns about this. Consistently use parentheses as we already do in some places to silence the warning. Closes https://github.com/curl/curl/pull/3866
* urlapi: add CURLUPART_ZONEID to set and getDaniel Stenberg2019-05-051-0/+38
| | | | | | | | The zoneid can be used with IPv6 numerical addresses. Updated test 1560 to verify. Closes #3834
* urlapi: strip off scope id from numerical IPv6 addressesDaniel Stenberg2019-05-031-1/+120
| | | | | | | | | | ... 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
* CURL_MAX_INPUT_LENGTH: largest acceptable string input sizeDaniel Stenberg2019-04-292-2/+82
| | | | | | | | | | | | | | | | | This limits all accepted input strings passed to libcurl to be less than CURL_MAX_INPUT_LENGTH (8000000) bytes, for these API calls: curl_easy_setopt() and curl_url_set(). The 8000000 number is arbitrary picked and is meant to detect mistakes or abuse, not to limit actual practical use cases. By limiting the acceptable string lengths we also reduce the risk of integer overflows all over. NOTE: This does not apply to `CURLOPT_POSTFIELDS`. Test 1559 verifies. Closes #3805
* tests: Run global cleanup at end of testsDaniel Gustafsson2019-04-153-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* urlapi: stricter CURLUPART_PORT parsingDaniel Stenberg2019-04-131-29/+67
| | | | | | | | | | | Only allow well formed decimal numbers in the input. Document that the number MUST be between 1 and 65535. Add tests to test 1560 to verify the above. Ref: https://github.com/curl/curl/issues/3753 Closes #3762
* test1906: verify CURLOPT_CURLU + CURLOPT_PORT usageDaniel Stenberg2019-04-112-1/+76
| | | | Based-on-code-by: Poul T Lomholt
* build: fix Codacy/CppCheck warningsMarcel Raad2019-04-111-1/+3
| | | | | | | | | | - remove unused variables - declare conditionally used variables conditionally - suppress unused variable warnings in the CMake tests - remove dead variable stores - consistently use WIN32 macro to detect Windows Closes https://github.com/curl/curl/pull/3739
* lib557: initialize variablesMarcel Raad2019-04-111-7/+7
| | | | | | These variables are only conditionally initialized. Closes https://github.com/curl/curl/pull/3739
* lib509: add missing include for strdupMarcel Raad2019-04-111-0/+2
| | | | Closes https://github.com/curl/curl/pull/3739
* test: urlapi: urlencode characters above 0x7f correctlyJakub Zakrzewski2019-04-071-0/+4
|
* pipelining: removedDaniel Stenberg2019-04-062-147/+1
| | | | | | | As previously planned and documented in DEPRECATE.md, all pipelining code is removed. Closes #3651
* test1541: threaded connection sharingDaniel Stenberg2019-03-182-1/+156
| | | | | | | | | The threaded-shared-conn.c example turned into test case. Only works if pthread was detected. An attempt to detect future regressions such as e3a53e3efb942a5 Closes #3687
* 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
* memdebug: make debug-specific functions use curl_dbg_ prefixDaniel Stenberg2019-03-081-3/+3
| | | | | | | To not "collide" or use up the regular curl_ name space. Also makes them easier to detect in helper scripts. Closes #3656
* tests: fix multiple may be used uninitialized warningsDaniel Stenberg2019-03-055-10/+12
|
* CURLU: fix NULL dereference when used over proxyDaniel Stenberg2019-03-042-0/+80
| | | | | | | | Test 659 verifies Also fixed the test 658 name Closes #3641
* cookies: only save the cookie file if the engine is enabledDaniel Stenberg2019-02-272-1/+98
| | | | | | | | | | | | | | | | | | | Follow-up to 8eddb8f4259. If the cookieinfo pointer is NULL there really is nothing to save. Without this fix, we got a problem when a handle was using shared object with cookies and is told to "FLUSH" it to file (which worked) and then the share object was removed and when the easy handle was closed just afterwards it has no cookieinfo and no cookies so it decided to save an empty jar (overwriting the file just flushed). Test 1905 now verifies that this works. Assisted-by: Michael Wallner Assisted-by: Marcel Raad Closes #3621
* connection: never reuse CONNECT_ONLY conectionsDaniel Stenberg2019-02-191-62/+42
| | | | | | | | and make CONNECT_ONLY conections never reuse any existing ones either. Reported-by: Pavel Löbl Bug: https://curl.haxx.se/mail/lib-2019-02/0064.html Closes #3586
* gssapi: fix deprecated header warningsDaniel Stenberg2019-02-141-9/+9
| | | | | | Heimdal includes on FreeBSD spewed out lots of them. Less so now. Closes #3566
* test1558: verify CURLINFO_PROTOCOL on file:// transferDaniel Stenberg2019-01-102-0/+69
| | | | | | Attempt to reproduce issue #3444. Closes #3447
* curl_multi_remove_handle() don't block terminating c-ares requestsBrad Spencer2019-01-072-1/+124
| | | | | | | | | Added Curl_resolver_kill() for all three resolver modes, which only blocks when necessary, along with test 1592 to confirm curl_multi_remove_handle() doesn't block unless it must. Closes #3428 Fixes #3371
* printf: fix format specifiersRikard Falkeborn2019-01-041-1/+1
| | | | Closes #3426
* libtest/stub_gssapi: use "real" snprintfDaniel Stenberg2019-01-031-7/+6
| | | | | | | | | | | | | ... since it doesn't link with libcurl. Reverts the commit dcd6f81025 changes from this file. Bug: https://curl.haxx.se/mail/lib-2019-01/0000.html Reported-by: Shlomi Fish Reviewed-by: Daniel Gustafsson Reviewed-by: Kamil Dudka Closes #3434
* http: minor whitespace cleanup from f464535bDaniel Stenberg2018-12-141-1/+0
|
* http: Implement trailing headers for chunked transfersAyoub Boudhar2018-12-143-0/+112
| | | | | | | | | | | | | This adds the CURLOPT_TRAILERDATA and CURLOPT_TRAILERFUNCTION options that allow a callback based approach to sending trailing headers with chunked transfers. The test server (sws) was updated to take into account the detection of the end of transfer in the case of trailing headers presence. Test 1591 checks that trailing headers can be sent using libcurl. Closes #3350
* Curl_follow: extract the Location: header field unvalidatedDaniel Stenberg2018-12-122-1/+78
| | | | | | | | | | | ... when not actually following the redirect. Otherwise we return error for this and an application can't extract the value. Test 1518 added to verify. Reported-by: Pavel Pavlov Fixes #3340 Closes #3364
* snprintf: renamed and we now only use msnprintf()Daniel Stenberg2018-11-2320-115/+121
| | | | | | | | | | | 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
* setopt: add CURLOPT_CURLUJim Fuller2018-11-092-1/+81
| | | | | | Allows an application to pass in a pre-parsed URL via a URL handle. Closes #3227
* urlapi: only skip encoding the first '=' with APPENDQUERY setDaniel Stenberg2018-11-071-1/+1
| | | | | | | | | APPENDQUERY + URLENCODE would skip all equals signs but now it only skip encoding the first to better allow "name=content" for any content. Reported-by: Alexey Melnichuk Fixes #3231 Closes #3231
* url: a short host name + port is not a schemeDaniel Stenberg2018-11-061-0/+14
| | | | | | | | | | | | | | | | | | | The function identifying a leading "scheme" part of the URL considered a few letters ending with a colon to be a scheme, making something like "short:80" to become an unknown scheme instead of a short host name and a port number. Extended test 1560 to verify. Also fixed test203 to use file_pwd to make it get the correct path on windows. Removed test 2070 since it was a duplicate of 203. Assisted-by: Marcel Raad Reported-by: Hagai Auro Fixes #3220 Fixes #3233 Closes #3223 Closes #3235
* Revert "url: a short host name + port is not a scheme"Daniel Stenberg2018-11-051-3/+0
| | | | | | | This reverts commit 226cfa8264cd979eff3fd52c0f3585ef095e7cf2. This commit caused test failures on appveyor/windows. Work on fixing them is in #3235.
* url: a short host name + port is not a schemeDaniel Stenberg2018-11-031-0/+3
| | | | | | | | | | | | The function identifying a leading "scheme" part of the URL considered a few letters ending with a colon to be a scheme, making something like "short:80" to become an unknown scheme instead of a short host name and a port number. Extended test 1560 to verify. Reported-by: Hagai Auro Fixes #3220 Closes #3223
* URL: fix IPv6 numeral address parserDaniel Stenberg2018-11-031-0/+9
| | | | | | | | Regression from 46e164069d1a52. Extended test 1560 to verify. Reported-by: tpaukrt on github Fixes #3218 Closes #3219
* CMake: suppress MSVC warning C4127 for libtestMarcel Raad2018-10-051-0/+4
| | | | It's issued by older Windows SDKs (prior to version 8.0).
* cmake: fixed path used in generation of docs/tests during curl build through ↵Sergei Nikulov2018-09-281-2/+2
| | | | add_subdicectory(...)
* Curl_dedotdotify(): always nul terminate returned string.Even Rouault2018-09-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes potential out-of-buffer access on "file:./" URL $ valgrind curl "file:./" ==24516== Memcheck, a memory error detector ==24516== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==24516== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==24516== Command: /home/even/install-curl-git/bin/curl file:./ ==24516== ==24516== Conditional jump or move depends on uninitialised value(s) ==24516== at 0x4C31F9C: strcmp (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==24516== by 0x4EBB315: seturl (urlapi.c:801) ==24516== by 0x4EBB568: parseurl (urlapi.c:861) ==24516== by 0x4EBC509: curl_url_set (urlapi.c:1199) ==24516== by 0x4E644C6: parseurlandfillconn (url.c:2044) ==24516== by 0x4E67AEF: create_conn (url.c:3613) ==24516== by 0x4E68A4F: Curl_connect (url.c:4119) ==24516== by 0x4E7F0A4: multi_runsingle (multi.c:1440) ==24516== by 0x4E808E5: curl_multi_perform (multi.c:2173) ==24516== by 0x4E7558C: easy_transfer (easy.c:686) ==24516== by 0x4E75801: easy_perform (easy.c:779) ==24516== by 0x4E75868: curl_easy_perform (easy.c:798) Was originally spotted by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10637 Credit to OSS-Fuzz Closes #3039
* whitespace fixesViktor Szakats2018-09-2342-45/+2
| | | | | | | | | | | - 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
* urlapi: fix support for address scope in IPv6 numerical addressesDaniel Stenberg2018-09-211-0/+3
| | | | Closes #3024
* urlapi: document the error codes, remove two unused onesDaniel Stenberg2018-09-191-20/+20
| | | | | Assisted-by: Daniel Gustafsson Closes #3019
* urlapi: add CURLU_GUESS_SCHEME and fix hostname acceptanceDaniel Stenberg2018-09-191-1/+25
| | | | | | | | | | | | | | | In order for this API to fully work for libcurl itself, it now offers a CURLU_GUESS_SCHEME flag that makes it "guess" scheme based on the host name prefix just like libcurl always did. If there's no known prefix, it will guess "http://". Separately, it relaxes the check of the host name so that IDN host names can be passed in as well. Both these changes are necessary for libcurl itself to use this API. Assisted-by: Daniel Gustafsson Closes #3018
* libtest: Add chkdecimalpoint to .gitignoreRikard Falkeborn2018-09-151-0/+1
| | | | Closes #2998
* URL-APIDaniel Stenberg2018-09-083-0/+769
| | | | | | | See header file and man pages for API. All documented API details work and are tested in the 1560 test case. Closes #2842
* lib1522: fix curl_easy_setopt argument typeMarcel Raad2018-08-241-1/+1
| | | | CURLOPT_POSTFIELDSIZE is a long option.
* test1148: disable if decimal separator is not pointMarcel Raad2018-08-213-0/+51
| | | | | | | | | Modifying the locale with environment variables doesn't work for native Windows applications. Just disable the test in this case if the decimal separator is something different than a point. Use a precheck with a small C program to achieve that. Closes https://github.com/curl/curl/pull/2786
* curl-compilers: enable -Wbad-function-cast on GCCMarcel Raad2018-08-211-1/+4
| | | | | | | This warning used to be enabled only for clang as it's a bit stricter on GCC. Silence the remaining occurrences and enable it on GCC too. Closes https://github.com/curl/curl/pull/2747
* CURLINFO_SIZE_UPLOAD: fix missing counter updateDaniel Stenberg2018-08-112-1/+91
| | | | | | | | Adds test 1522 for verification. Reported-by: cjmsoregan Fixes #2847 Closes #2864
* lib1502: fix memory leak in torture testDaniel Stenberg2018-08-101-0/+2
| | | | | | Reported-by: Marcel Raad Fixes #2861 Closes #2863