summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* urldata: don't touch data->set.httpversion at run-timebagder/http-state-versionDaniel Stenberg2021-02-112-1/+58
| | | | | | | | | Rename it to 'httpwant' and make a cloned field in the state struct as well for run-time updates. Also: refuse non-supported HTTP versions. Verified with test 129. Closes #6585
* curl: add --fail-with-bodyDaniel Stenberg2021-02-115-3/+128
| | | | | | | | Prevent both --fail and --fail-with-body on the same command line. Verify with test 349, 360 and 361. Closes #6449
* tests: Fix tests failing due to change in curl --helpJay Satiro2021-02-102-2/+2
| | | | | | | Follow-up to parent 3183217 which added add missing <mode> argument to --create-file-mode <mode>. Ref: https://github.com/curl/curl/issues/6590
* server: remove redundant conditionMarcel Raad2021-02-102-2/+0
| | | | | | `end` is always non-null here. Closes https://github.com/curl/curl/pull/6576
* mqttd: remove unused variableMarcel Raad2021-02-101-2/+0
| | | | Closes https://github.com/curl/curl/pull/6576
* tests: reduce variable scopesMarcel Raad2021-02-102-7/+4
| | | | Closes https://github.com/curl/curl/pull/6576
* ftp: add 'list_only' to the transfer state structDaniel Stenberg2021-02-092-1/+74
| | | | | | | | | and rename it from 'ftp_list_only' since it is also used for SSH and POP3. The state is updated internally for 'type=D' FTP URLs. Added test case 1570 to verify. Closes #6578
* ftp: add 'prefer_ascii' to the transfer state structDaniel Stenberg2021-02-094-2/+124
| | | | | | | | | | | ... 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
* 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
* tool_writeout: refactor write-out and write-out jsonJay Satiro2021-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | - Deduplicate the logic used by write-out and write-out json. Rather than have separate writeLong, writeString, etc, logic for each of write-out and write-out json instead have respective shared functions that can output either format and a 'use_json' parameter to indicate whether it is json that is output. This will make it easier to maintain. Rather than have to go through two sets of logic now we only have to go through one. - Support write-out %{errormsg} and %{exitcode} in json. - Clarify in the doc that %{exitcode} is the exit code of the transfer. Prior to this change it just said "The numerical exitcode" which implies it's the exit code of the tool, and it's not necessarily that. Closes https://github.com/curl/curl/pull/6544
* file: Support unicode urls on windowsStephan Szabo2021-02-094-1/+52
| | | | Closes https://github.com/curl/curl/pull/6501
* tests/server: Bump MAX_TAG_LEN to 200Fabian Keil2021-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful for tests containing HTML inside of <data> sections. For <img> tags it's not uncommon to be longer than the previous limit of 79 bytes. An example of a previously problem-causing tag is: <img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-http://www.privoxy.org/images/privoxy.png-by-size" width="88" height="31"> which is needed for a Privoxy test for the banners-by-size filter. Previously it caused server failures like: 12:29:05.786961 ====> Client connect 12:29:05.787116 accept_connection 3 returned 4 12:29:05.787194 accept_connection 3 returned 0 12:29:05.787285 Read 119 bytes 12:29:05.787345 Process 119 bytes request 12:29:05.787407 Got request: GET /banners-by-size/9 HTTP/1.1 12:29:05.787464 Requested test number 9 part 0 12:29:05.787686 getpart() failed with error: -2 12:29:05.787744 - request found to be complete (9) 12:29:05.787912 getpart() failed with error: -2 12:29:05.788048 Wrote request (119 bytes) input to log/server.input 12:29:05.788157 Send response test9 section <data> 12:29:05.788443 getpart() failed with error: -2 12:29:05.788498 instructed to close connection after server-reply 12:29:05.788550 ====> Client disconnect 0 12:29:05.871448 exit_signal_handler: 15 12:29:05.871714 signalled to die 12:29:05.872040 ========> IPv4 sws (port 21108 pid: 51758) exits with signal (15)
* tests/badsymbols.pl: when opening '$incdir' fails include it in the error ↵Fabian Keil2021-02-091-1/+1
| | | | message
* runtests.1: document -o, -P, -L, and -EFabian Keil2021-02-091-1/+22
|
* runtests.pl: add %TESTNUMBER variable to make copying tests more convenientFabian Keil2021-02-094-5/+56
|
* runtests.pl: add an -o option to change internal variablesFabian Keil2021-02-091-0/+10
| | | | | | | | | runtests.pl has lots of internal variables one might want to change in certain situations, but adding a dedicated option for every single one of them isn't practical. Usage: ./runtests.pl -o TESTDIR=$privoxy_curl_test_dir -o HOSTIP=10.0.0.1 ...
* runtests.pl: cleanupsFabian Keil2021-02-091-27/+36
| | | | | | | | | | - show the summarized test result in the last line of the report - do not use $_ after mapping it to a named variable Doing that makes the code harder to follow. - log the restraints sorted by the number of their occurrences - fix language when logging restraints that only occured once - let runhttpserver() use $TESTDIR instead of $srcdir ... so it works if a non-default $TESTDIR is being used.
* runtests.pl: add an -E option to specify an exclude fileFabian Keil2021-02-094-1/+90
| | | | | | | | | | | | | | | | | | | | | It can contain additional restraints for test numbers, keywords and tools. The idea is to let third parties like the Privoxy project distribute an exclude file with their tarballs that specifies which curl tests are not expected to work when using Privoxy as a proxy, without having to fork the whole curl test suite. The syntax could be changed to be extendable and maybe more closely reflect the "curl test" syntax. Currently it's a bunch of lines like these: test:$TESTNUMBER:Reason why this test with number $TESTNUMBER should be skipped keyword:$KEYWORD:Reason why tests whose keywords contain the $KEYWORD should be skipped tool:$TOOL:Reason why tests with tools that contain $TOOL should be skipped To specify multiple $TESTNUMBERs, $KEYWORDs and $TOOLs on a single line, split them with commas.
* runtests.pl: add -L parameter to require additional perl librariesFabian Keil2021-02-093-1/+42
| | | | | | | | | | This is useful to change the behaviour of the script without having to modify the file itself, for example to use a custom compareparts() function that ignores header differences that are expected to occur when an external proxy is being used. Such differences are proxy-specific and thus the modifications should be maintained together with the proxy.
* runtests.pl: add a -P option to specify an external proxyFabian Keil2021-02-091-0/+35
| | | | | | | | | | | | ... that should be used when executing the tests. The assumption is that the proxy is an HTTP proxy. This option should be used together with -L to provide a customized compareparts() version that knows which proxy-specific header differences should be ignored. This option doesn't work for all test types yet.
* tests: fixup several testsFabian Keil2021-02-09430-779/+787
| | | | | | | | | | | | | | 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
* ftp: avoid SIZE when asking for a TYPE A fileDaniel Stenberg2021-02-048-62/+5
| | | | | | | | | | | ... as we ignore it anyway because servers don't report the correct size and proftpd even blatantly returns a 550. Updates a set of tests accordingly. Reported-by: awesomenode on github Fixes #6564 Closes #6565
* copyright: fix year ranges in need of updatesDaniel Stenberg2021-02-034-4/+4
|
* http: improve AWS HTTP v4 Signature authDmitry Wagin2021-01-3010-8/+409
| | | | | | | | | | | | | | | | | | - 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
* copyright: fix missing year (range) updatesDaniel Stenberg2021-01-291-1/+1
|
* tool_writeout: make %{errormsg} blank for no errorsDaniel Stenberg2021-01-281-1/+1
| | | | Closes #6539
* test410: fix for windowsJay Satiro2021-01-251-1/+4
| | | | | | | | | | - Pass the very long request header via file instead of command line. Prior to this change the 49k very long request header string was passed via command line and on Windows that is too long so it was truncated and the test would fail (specifically msys CI). Closes https://github.com/curl/curl/pull/6516
* hostip: remove conn->data from resolver functionsDaniel Stenberg2021-01-221-1/+1
| | | | | | | This also moves the 'async' struct from the connectdata struct into the Curl_easy struct, which seems like a better home for it. Closes #6497
* http: get CURLOPT_REQUEST_TARGET working with a HTTP proxyFabian Keil2021-01-202-1/+54
| | | | | | Added test 1613 to verify. Closes #6490
* Add test1181: Proxy request with --proxy-header "Connection: Keep-Alive"Fabian Keil2021-01-192-1/+49
|
* Add test1180: Proxy request with -H "Proxy-Connection: Keep-Alive"Fabian Keil2021-01-192-1/+49
| | | | | At the moment the test fails as curl sends two Proxy-Connection headers.
* runtests: preprocess DISABLED to allow conditionalsDaniel Stenberg2021-01-191-9/+19
| | | | | | | ... with this function provided, we can disable tests for specific environments and setups directly within this file. Closes #6477
* runtests: turn preprocessing into a separate functionDaniel Stenberg2021-01-191-73/+52
| | | | | ... and remove all other variable substitutions as they're now done once and for all in the preprocessor.
* test410: verify HTTPS GET with a 49K request headerDaniel Stenberg2021-01-182-1/+53
| | | | skip test 410 for mesalink in the CI as it otherwise hangs "forever"
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-172-8/+4
| | | | | | | | | | | | | | | | | | | | | ... 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
* test1918: verify curl_easy_option_by_name() and curl_easy_option_by_id()Daniel Stenberg2021-01-154-2/+95
| | | | | | | | | | | | ... 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-154-4/+102
| | | | | | | | | | | | ... 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
* misc: fix typosFabian Keil2021-01-111-1/+1
| | | | | Bug: https://curl.se/mail/lib-2021-01/0063.html Closes #6434
* test179: use consistent header line endingsDaniel Stenberg2021-01-081-1/+1
| | | | ... to make "Hyper mode" work better.
* http: have CURLOPT_FAILONERROR fail after all headersDaniel Stenberg2021-01-064-5/+73
| | | | | | | | | | ... so that Retry-After and other meta-content can still be used. Added 1634 to verify. Adjusted test 194 and 281 since --fail now also includes the header-terminating CRLF in the output before it exits. Fixes #6408 Closes #6409
* global_init: debug builds allocates a byte in initDaniel Stenberg2021-01-061-0/+1
| | | | | | | | | | ... to make build tools/valgrind warn if no curl_global_cleanup is called. This is conditionally only done for debug builds with the env variable CURL_GLOBAL_INIT set. Closes #6410
* lib/unit tests: add missing curl_global_cleanup() callsDaniel Stenberg2021-01-0616-50/+84
|
* test66: disable with HyperDaniel Stenberg2021-01-051-0/+3
| | | | ...as Hyper doesn't support HTTP/0.9
* test1633: set appropriate nameDaniel Stenberg2021-01-041-4/+4
| | | | "--retry with a 429 response and Retry-After:"
* httpauth: make multi-request auth work with custom portDaniel Stenberg2021-01-024-4/+143
| | | | | | | | | | | | 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-024-6/+6
| | | | | | | | 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
* 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
* misc: assorted typo fixesXhmikosR2020-12-262-2/+2
| | | | Closes #6375