summaryrefslogtreecommitdiff
path: root/tests/data
Commit message (Collapse)AuthorAgeFilesLines
* file: support GETing directories againLuke Granger-Brown2021-04-052-1/+36
| | | | | | | | | | | | | | After 957bc1881e686f9714c4e6a01bf33535091f0e21, we no longer compute an expected_size for directories. This has the upshot that when we compare even an empty Range with the available size, we fail. This brings back the previous behaviour, which was to succeed, but with empty content. This also removes the "Accept-ranges: bytes" header, which is nonsensical on directories. Adds test 3016 Fixes #6845 Closes #6846
* transfer: strip credentials from the auto-referer header fieldViktor Szakats2021-03-282-1/+67
| | | | | | | | Added test 2081 to verify. CVE-2021-22876 Bug: https://curl.se/docs/CVE-2021-22876.html
* http: strip default port from URL sent to proxyDaniel Stenberg2021-03-231-1/+1
| | | | | | | | | | To make sure the Host: header and the URL provide the same authority portion when sent to the proxy, strip the default port number from the URL if one was provided. Reported-by: Michael Brown Fixes #6769 Closes #6778
* tests: use %TESTNUMBER instead of fixed numberDaniel Stenberg2021-03-191292-4389/+4386
| | | | | | | This makes the tests easier to copy and relocate to other test numbers without having to update content. Closes #6738
* http: make 416 not fail with resume + CURLOPT_FAILONERRRORDaniel Stenberg2021-03-173-4/+84
| | | | | | | | | | | | | 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
* test220/314: adjust to run with HyperDaniel Stenberg2021-03-112-0/+16
|
* test306: make it not run with HyperDaniel Stenberg2021-03-111-0/+1
| | | | ... as it tests HTTP/0.9 which Hyper doesn't support.
* test304: header CRLF cleanup to work with HyperDaniel Stenberg2021-03-111-1/+1
|
* FTP: allow SIZE to fail when doing (resumed) uploadDaniel Stenberg2021-03-112-1/+52
| | | | | | | | | Added test 362 to verify. Reported-by: Jordan Brown Regression since 7ea2e1d0c5a7f (7.73.0) Fixes #6715 Closes #6725
* tool_help: Increase space between option and descriptionJay Satiro2021-02-283-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Increase the minimum number of spaces between the option and the description from 1 to 2. Before: ~~~ -u, --user <user:password> Server user and password -A, --user-agent <name> Send User-Agent <name> to server -v, --verbose Make the operation more talkative -V, --version Show version number and quit -w, --write-out <format> Use output FORMAT after completion --xattr Store metadata in extended file attributes ~~~ After: ~~~ -u, --user <user:password> Server user and password -A, --user-agent <name> Send User-Agent <name> to server -v, --verbose Make the operation more talkative -V, --version Show version number and quit -w, --write-out <format> Use output FORMAT after completion --xattr Store metadata in extended file attributes ~~~ Closes https://github.com/curl/curl/pull/6674
* cookies: Support multiple -b parametersDaniel Gustafsson2021-02-252-4/+8
| | | | | | | | | | Previously only a single -b cookie parameter was supported with the last one winning. This adds support for supplying multiple -b params to have them serialized semicolon separated. Both cookiefiles and cookies can be entered multiple times. Closes #6649 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* test1188: Check for --fail HTTP statusJay Satiro2021-02-201-6/+15
| | | | | | | | | | | | | | | - Change the test to check for curl error on HTTP 404 Not Found. test1188 tests "--write-out with %{onerror} and %{urlnum} to stderr". Prior to this change it did that by specifying a non-existent host which would cause an error. ISPs may hijack DNS and resolve non-existent hosts so the test would not work if that was the case. Ref: https://en.wikipedia.org/wiki/DNS_hijacking#Manipulation_by_ISPs Ref: https://github.com/curl/curl/issues/6621 Ref: https://github.com/curl/curl/pull/6623 Closes https://github.com/curl/curl/pull/6637
* http: add support to read and store the referrer headerViktor Szakats2021-02-192-2/+5
| | | | | | | | | - add CURLINFO_REFERER libcurl option - add --write-out '%{referer}' command-line option - extend --xattr command-line option to fill user.xdg.referrer.url extended attribute with the referrer (if there was any) Closes #6591
* test1188: change error from connect to resolve errorDaniel Stenberg2021-02-181-2/+2
| | | | | | | | | | | | Using the %NOLISTENPORT to trigger a connection failure is somewhat "risky" (since it isn't guaranteed to not be listened to) and caused occasional CI problems. This fix changes the infused error to be a more reliable one but still verifies the --write-out functionality properly - which is the purpose of this test. Reported-by: Jay Satiro Fixes #6621 Closes #6623
* http: use credentials from transfer, not connectionDaniel Stenberg2021-02-133-4/+61
| | | | | | | | | | | | | | | | | | | HTTP auth "accidentally" worked before this cleanup since the code would always overwrite the connection credentials with the credentials from the most recent transfer and since HTTP auth is typically done first thing, this has not been an issue. It was still wrong and subject to possible race conditions or future breakage if the sequence of functions would change. The data.set.str[] strings MUST remain unmodified exactly as set by the user, and the credentials to use internally are instead set/updated in state.aptr.* Added test 675 to verify different credentials used in two requests done over a reused HTTP connection, which previously behaved wrongly. Fixes #6542 Closes #6545
* test433: clear some home dir env variablesDaniel Stenberg2021-02-121-0/+2
| | | | | | | | | | Follow-up to bd6b54ba1f55b5 ... so that XDG_CONFIG_HOME is the only home dir variable set and thus used correctly in the test! Fixes #6599 Closes #6600
* urldata: don't touch data->set.httpversion at run-timeDaniel Stenberg2021-02-122-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
* 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-092-1/+74
| | | | | | | | | | | ... 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
* 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-092-1/+46
| | | | Closes https://github.com/curl/curl/pull/6501
* runtests.pl: add %TESTNUMBER variable to make copying tests more convenientFabian Keil2021-02-092-1/+49
|
* runtests.pl: add an -E option to specify an exclude fileFabian Keil2021-02-093-1/+41
| | | | | | | | | | | | | | | | | | | | | 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-092-1/+36
| | | | | | | | | | 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.
* tests: fixup several testsFabian Keil2021-02-09429-777/+785
| | | | | | | | | | | | | | 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
* http: improve AWS HTTP v4 Signature authDmitry Wagin2021-01-305-5/+212
| | | | | | | | | | | | | | | | | | - 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
* 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.
* 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-171-0/+1
| | | | | | | | | | | | | | | | | | | | | ... 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-152-1/+36
| | | | | | | | | | | | ... 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-1/+82
| | | | | | | | | | | | ... 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
* 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
* lib/unit tests: add missing curl_global_cleanup() callsDaniel Stenberg2021-01-061-0/+2
|
* 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-022-2/+89
| | | | | | | | | | | | 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
* misc: assorted typo fixesXhmikosR2020-12-261-1/+1
| | | | Closes #6375
* test: verify new --write-out variablesDaniel Stenberg2020-12-213-2/+51
| | | | Extended test 1029 and added 1188
* test970: adapted to the new internal order of variablesDaniel Stenberg2020-12-211-1/+1
|
* tests: add very simple AWS HTTP v4 Signature testMatthias Gatto2020-12-212-1/+70
| | | | Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>
* curl: add --create-file-mode [mode]Daniel Stenberg2020-12-212-0/+2
| | | | | | | | This option sets the (octal) mode to use for the remote file when one is created, using the SFTP, SCP or FILE protocols. When not set, the default is 0644. Closes #6244