summaryrefslogtreecommitdiff
path: root/tests/libtest
Commit message (Collapse)AuthorAgeFilesLines
* urlapi: "normalize" numerical IPv4 host namesbagder/urlapi-normalize-ipv4Daniel Stenberg2021-04-081-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the host name in a URL is given as an IPv4 numerical address, the address can be specified with dotted numericals in four different ways: a32, a.b24, a.b.c16 or a.b.c.d and each part can be specified in decimal, octal (0-prefixed) or hexadecimal (0x-prefixed). Instead of passing on the name as-is and leaving the handling to the underlying name functions, which made them not work with c-ares but work with getaddrinfo, this change now makes the curl URL API itself detect and "normalize" host names specified as IPv4 numericals. The WHATWG URL Spec says this is an okay way to specify a host name in a URL. RFC 3896 does not allow them, but curl didn't prevent them before and it seems other RFC 3896-using tools have not either. Host names used like this are widely supported by other tools as well due to the handling being done by getaddrinfo and friends. I decided to add the functionality into the URL API itself so that all users of these functions get the benefits, when for example wanting to compare two URLs. Also, it makes curl built to use c-ares now support them as well and make curl builds more consistent. The normalization makes HTTPS and virtual hosted HTTP work fine even when curl gets the address specified using one of the "obscure" formats. Test 1560 is extended to verify. Fixes #6863 Closes #6871
* copyright: update copyright year ranges to 2021Daniel Stenberg2021-03-273-3/+3
| | | | | Reviewed-by: Emil Engler Closes #6802
* http: make 416 not fail with resume + CURLOPT_FAILONERRRORDaniel Stenberg2021-03-171-17/+18
| | | | | | | | | | | | | When asked to resume a download, libcurl will convert that to HTTP logic and if then the entire file is already transferred it will result in a 416 response from the HTTP server. With CURLOPT_FAILONERRROR set in that scenario, it should *not* lead to an error return. Updated test 1156, added test 1273 Reported-by: Jonathan Watt Fixes #6740 Closes #6753
* configure: provide Largefile feature for curl-configDaniel Stenberg2021-03-111-2/+2
| | | | | | ... as cmake now does it correctly, and make test1014 check for it Closes #6702
* lib1536: check ptr against NULL before dereferencing itkokke2021-03-101-1/+1
| | | | Closes #6710
* lib1537: check ptr against NULL before dereferencing itkokke2021-03-101-1/+1
| | | | | Fixes #6707 Closes #6708
* tests: reduce variable scopesMarcel Raad2021-02-101-5/+2
| | | | Closes https://github.com/curl/curl/pull/6576
* ftp: add 'prefer_ascii' to the transfer state structDaniel Stenberg2021-02-092-1/+50
| | | | | | | | | | | ... and make sure the code never updates 'set.prefer_ascii' as it breaks handle reuse which should use the setting as the user specified it. Added test 1569 to verify: it first makes an FTP transfer with ';type=A' and then another without type on the same handle and the second should then use binary. Previously, curl failed this. Closes #6578
* tests: fixup several testsFabian Keil2021-02-091-2/+2
| | | | | | | | | | | | | | missing CRs and modified %hostip lib556/test556: use a real HTTP version to make test reuse more convenient make sure the weekday in Date headers matches the date test61: replace stray "^M" (5e 4d) at the end of a cookie with a '^M' (0d) Gets the test working with external proxies like Privoxy again. Closes #6463
* copyright: fix year ranges in need of updatesDaniel Stenberg2021-02-034-4/+4
|
* http: improve AWS HTTP v4 Signature authDmitry Wagin2021-01-305-3/+197
| | | | | | | | | | | | | | | | | | - Add support services without region and service prefixes in the URL endpoint (ex. Min.IO, GCP, Yandex Cloud, Mail.Ru Cloud Solutions, etc) by providing region and service parameters via aws-sigv4 option. - Add [:region[:service]] suffix to aws-sigv4 option; - Fix memory allocation errors. - Refactor memory management. - Use Curl_http_method instead() STRING_CUSTOMREQUEST. - Refactor canonical headers generating. - Remove repeated sha256_to_hex() usage. - Add some docs fixes. - Add some codestyle fixes. - Add overloaded strndup() for debug - curl_dbg_strndup(). - Update tests. Closes #6524
* test1918: verify curl_easy_option_by_name() and curl_easy_option_by_id()Daniel Stenberg2021-01-152-1/+59
| | | | | | | | | | | | ... and as a practical side-effect, make sure that the Curl_easyopts_check() function is asserted in debug builds, which we want to detect mismatches between the options list in easyoptions.c and the options in curl.h Found-by: Gisle Vanem Bug: https://github.com/curl/curl/commit/08e8455dddc5e48e58a12ade3815c01ae3da3b64#commitcomment-45991815 Closes #6461
* mime: make sure setting MIMEPOST to NULL resets properlyDaniel Stenberg2021-01-152-3/+20
| | | | | | | | | | | | ... so that a function can first use MIMEPOST and then set it to NULL to reset it back to a blank POST. Added test 584 to verify the fix. Reported-by: Christoph M. Becker Fixes #6455 Closes #6456
* lib/unit tests: add missing curl_global_cleanup() callsDaniel Stenberg2021-01-065-32/+43
|
* httpauth: make multi-request auth work with custom portDaniel Stenberg2021-01-022-2/+54
| | | | | | | | | | | | When doing HTTP authentication and a port number set with CURLOPT_PORT, the code would previously have the URL's port number override as if it had been a redirect to an absolute URL. Added test 1568 to verify. Reported-by: UrsusArctos on github Fixes #6397 Closes #6400
* language: s/behaviour/behavior/gEmil Engler2021-01-021-2/+2
| | | | | | | | We currently use both spellings the british "behaviour" and the american "behavior". However "behavior" is more used in the project so I think it's worth dropping the british name. Closes #6395
* docs/examples: adjust prototypes for CURLOPT_READFUNCTIONOlaf Hering2020-12-3018-21/+21
| | | | | | | The type of the buffer in curl_read_callback is 'char *', not 'void *'. Signed-off-by: Olaf Hering <olaf@aepfle.de> Closes #6392
* examples/libtest: add .checksrc to distDaniel Stenberg2020-12-211-2/+2
| | | | | | | ... so that (auto)builds from tarballs also get the correct instructions. Fixes #6176 Closes #6353
* tests: add very simple AWS HTTP v4 Signature testMatthias Gatto2020-12-212-1/+66
| | | | Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
* mqtt: handle POST/PUBLISH without a set POSTFIELDSIZEDaniel Stenberg2020-12-182-1/+61
| | | | | | | | | Detected by OSS-Fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28735 Added test 1916 and 1917 to verify. Closes #6338
* test1522: add debug tracingDaniel Stenberg2020-12-172-12/+22
| | | | | | | I used this to track down some issues and I figured I could just as well keep this extra logging in here for future needs. Closes #6331
* lib1564/5: verify that curl_multi_wakeup returns OKDaniel Stenberg2020-12-112-3/+3
|
* infof/failf calls: fix format specifiersRikard Falkeborn2020-11-242-2/+2
| | | | | | Update a few format specifiers to match what is being printed. Closes #6241
* copyright: fix year rangesDaniel Stenberg2020-11-0579-79/+79
| | | | Follow-up from 4d2f8006777
* curl.se: new homeDaniel Stenberg2020-11-04173-177/+177
| | | | Closes #6172
* rtsp: fixed the RTST Session ID mismatch in test 570Harry Sintonen2020-11-041-1/+5
| | | | Closes #6161
* hsts: add read/write callbacksDaniel Stenberg2020-11-033-0/+102
| | | | | | | | - read/write callback options - man pages for the 4 new setopts - test 1915 verifies the callbacks Closes #5896
* tests: add missing global_init/cleanup callsDaniel Stenberg2020-11-022-2/+7
| | | | | | | Without the cleanup call in these test files, the mbedTLS backend leaks memory. Closes #6156
* urlapi: URL encode a '+' in the query partDaniel Stenberg2020-10-151-0/+7
| | | | | | | | | ... when asked to with CURLU_URLENCODE. Extended test 1560 to verify. Reported-by: Dietmar Hauser Fixes #6086 Closes #6087
* checksrc: warn on space after exclamation markDaniel Stenberg2020-10-022-4/+4
| | | | Closes #6034
* symbian: drop supportDaniel Stenberg2020-09-221-1/+1
| | | | | | | | | The OS is deprecated. I see no traces of anyone having actually built curl for Symbian after 2012. The public headers are unmodified. Closes #5989
* ftp: a 550 response to SIZE returns CURLE_REMOTE_FILE_NOT_FOUNDDaniel Stenberg2020-09-142-1/+53
| | | | | | | | | | | | | | | | | | | | This is primarily interesting for cases where CURLOPT_NOBODY is set as previously curl would not return an error for this case. MDTM getting 550 now also returns this error (it returned CURLE_FTP_COULDNT_RETR_FILE before) in order to unify return codes for missing files across protocols and specific FTP commands. libcurl already returns error on a 550 as a MDTM response (when CURLOPT_FILETIME is set). If CURLOPT_NOBODY is not set, an error would happen subsequently anyway since the RETR command would fail. Add test 1913 and 1914 to verify. Updated several tests accordingly due to the updated SIZE behavior. Reported-by: Tomas Berger Fixes #5953 Closes #5957
* curl: use curlx_dynbuf for realloc when loading config filesDaniel Stenberg2020-09-141-1/+1
| | | | | | | | | ... fixes an integer overflow at the same time. Reported-by: ihsinme on github Assisted-by: Jay Satiro Closes #5946
* lib583: fix enum mixupDaniel Stenberg2020-09-081-1/+1
| | | | grrr the previous follow-up to 17fcdf6a31 was wrong
* libtest: fix build errorsDaniel Stenberg2020-09-082-5/+10
| | | | Follow-up from 17fcdf6a310d4c8076
* lib: fix -Wassign-enum warningsDaniel Stenberg2020-09-088-38/+38
| | | | | | | | | | configure --enable-debug now enables -Wassign-enum with clang, identifying several enum "abuses" also fixed. Reported-by: Gisle Vanem Bug: https://github.com/curl/curl/commit/879007f8118771f4896334731aaca5850a154675#commitcomment-42087553 Closes #5929
* libtest: remove lib1541 leftoversDaniel Stenberg2020-09-071-4/+0
| | | | | | Caused automake errors. Follow-up to 8ca54a03ea08a
* tests/libtests: remove test 1900 and 2033Daniel Stenberg2020-09-071-10/+2
| | | | | | We already remove the test files, now remove the libtest codes as well. Follow-up to e50a877df74
* altsvc: clone setting in curl_easy_duphandlebagder/altsvc-duphandleDaniel Stenberg2020-09-061-0/+15
| | | | | | | | | | | | 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
* test1541: remove since it is a known bugDaniel Stenberg2020-09-062-2/+9
| | | | | | | | | | | A shared connection cache is not thread-safe is a known issue. Stop testing this until we believe this issue is addressed. Reduces occasional test failures we don't care about. The test code in lib1541.c is left in git to allow us to restore it when we get to fix this. Closes #5922
* tests: remove pipelining testsDaniel Stenberg2020-09-061-5/+1
| | | | | | | | | | Remove the tests 530, 584, 1900, 1901, 1902, 1903 and 2033. They were previously disabled. The Pipelining code was removed from curl in commit 2f44e94efb3df8e, April 2019. Closes #5921
* tests: add test1912 with typechecksJeroen Ooms2020-08-282-1/+85
| | | | | | Validates that gcc-typecheck macros match the new option type API. Closes #5873
* options: API for meta-data about easy optionsDaniel Stenberg2020-08-273-5/+98
| | | | | | | | | | | | | | | | const struct curl_easyoption *curl_easy_option_by_name(const char *name); const struct curl_easyoption *curl_easy_option_by_id (CURLoption id); const struct curl_easyoption * curl_easy_option_next(const struct curl_easyoption *prev); The purpose is to provide detailed enough information to allow for example libcurl bindings to get option information at run-time about what easy options that exist and what arguments they expect. Assisted-by: Jeroen Ooms Closes #5365
* git: ignore libtests in 3XXX areaEmil Engler2020-08-261-1/+1
| | | | | | | | Currently the file tests/libtest/lib3010 is not getting ignored by git. This fixes it by adding the 3XXX area to the according .gitignore file. Closes #5859
* lib1560: verify "redirect" to double-slash leading URLDaniel Stenberg2020-08-251-0/+8
| | | | Closes #5849
* libtest/Makefile.am: add -no-undefined for libstubgss for CygwinBrian Inglis2020-08-161-1/+4
| | | | | | | | | | | | copy the LDFLAGS approach for adding same option with `libhostname` in `libtest/Makefile.am`: - init `libstubgss_la_LDFLAGS_EXTRA` variable, - add option to variable inside conditional, - use variable in `libstubgss_la_LDFLAGS` Fixes #5819 Closes #5820
* copyright: update/correct the year range on a few filesDaniel Stenberg2020-08-142-2/+2
|
* checksrc: invoke script with -D to find .checksrc properDaniel Stenberg2020-08-011-1/+1
| | | | | | | | | | Without the -D command line option, checksrc.pl won't know which directory to load the ".checksrc" file from when building out of the source tree. Reported-by: Marcel Raad Fixes #5715 Closes #5755
* url: fix CURLU and location followingJay Satiro2020-07-302-1/+56
| | | | | | | | | | | Prior to this change if the user set a URL handle (CURLOPT_CURLU) it was incorrectly used for the location follow, resulting in infinite requests to the original location. Reported-by: sspiri@users.noreply.github.com Fixes https://github.com/curl/curl/issues/5709 Closes https://github.com/curl/curl/pull/5713
* checksrc: ban gmtime/localtimeDaniel Stenberg2020-07-281-0/+1
| | | | | | | | | They're not thread-safe so they should not be used in libcurl code. Explictly enabled when deemed necessary and in examples and tests Reviewed-by: Nicolas Sterchele Closes #5732