1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
Commit Graph

2102 Commits

Author SHA1 Message Date
Marcel Raad
87e0fcfe5c
TrackMemory tests: ignore realloc and free in getenv.c
These are only called for WIN32.

Closes https://github.com/curl/curl/pull/5767
2020-08-03 12:14:23 +02:00
Marc Aldorasi
d5bb459ccf
multi_remove_handle: close unused connect-only connections
Previously any connect-only connections in a multi handle would be kept
alive until the multi handle was closed.  Since these connections cannot
be re-used, they can be marked for closure when the associated easy
handle is removed from the multi handle.

Closes #5749
2020-08-01 15:26:08 +02:00
Jay Satiro
a12a16151a url: fix CURLU and location following
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
2020-07-30 11:57:35 -04:00
Nicolas Sterchele
0b85969226
getinfo: reset retry-after value in initinfo
- Avoid re-using retry_after value from preceding request
- Add libtest 3010 to verify

Reported-by: joey-l-us on github
Fixes #5661
Closes #5672
2020-07-27 12:15:44 +02:00
Daniel Stenberg
c13c67e127
test1139: make it display the difference on test failures 2020-07-14 18:31:37 +02:00
Daniel Stenberg
839e9f342b
test1119: verify stdout in the test
So that failures will be displayed in the terminal, as it makes test failures
visually displayed easier and faster.

Closes #5644
2020-07-14 18:31:30 +02:00
Daniel Stenberg
f5e6907d52
curl: add %{method} to the -w variables
Gets the CURLINFO_EFFECTIVE_METHOD from libcurl.

Added test 1197 to verify.
2020-07-14 17:53:45 +02:00
Gilles Vollant
e13357b14b
content_encoding: add zstd decoding support
include zstd curl patch for Makefile.m32 from vszakats
and include Add CMake support for zstd from Peter Wu

Helped-by: Viktor Szakats
Helped-by: Peter Wu
Closes #5453
2020-07-12 18:11:37 +02:00
Daniel Stenberg
9466034561
transfer: fix memory-leak with CURLOPT_CURLU in a duped handle
Added test case 674 to reproduce and verify the bug report.

Fixes #5665
Reported-by: NobodyXu on github
Closes #5673
2020-07-12 16:36:02 +02:00
Daniel Stenberg
1535363e72
ftpserver: don't verify SMTP MAIL FROM names
Rely on tests asking the names to get refused instead - test servers
should be as dumb as possible. Edited test 914, 955 and 959 accordingly.

Closes #5639
2020-07-03 10:10:30 +02:00
Daniel Stenberg
ff43fb6dec
http: fix proxy auth with blank password
Regression in 7.71.0

Added test case 346 to verify.

Reported-by: Kristoffer Gleditsch
Fixes #5613
Closes #5616
2020-06-28 00:29:59 +02:00
Daniel Stenberg
1529838a14
test1539: do a HTTP 1.0 POST without a set size (fails)
Attempt to reproduce #5593. Test case 1514 is very similar but uses
HTTP/1.1 and thus switches to chunked.

Closes #5595
2020-06-26 15:11:04 +02:00
Daniel Stenberg
8acfb932ef
tests: verify newline in username and password for HTTP
test 1296 is a simply command line test

test 1910 is a libcurl test including a redirect
2020-06-25 09:57:19 +02:00
Daniel Stenberg
79d8099ff0
test543: extended to verify zero length input
As was reported in #5601
2020-06-25 00:00:35 +02:00
Daniel Stenberg
5bf653464f
test1460: verify that -Ji is not ok 2020-06-22 00:50:08 +02:00
Daniel Stenberg
c888e3f6ce
test1179: verify error message for non-existing cmdline option 2020-06-18 13:59:49 +02:00
Daniel Stenberg
eab2f95c0d
wording: avoid blacklist/whitelist stereotypes
Instead of discussing if there's value or meaning (implied or not) in
the colors, let's use words without the same possibly negative
associations.

Closes #5546
2020-06-10 08:49:17 +02:00
Daniel Stenberg
876e66412a
tests: add two simple tests for --login-options
Test 895 and 896 - as a follow-up to a3e972313b

Closes #5539
2020-06-08 12:55:31 +02:00
Daniel Stenberg
9c845be279
urldata: let the HTTP method be in the set.* struct
When the method is updated inside libcurl we must still not change the
method as set by the user as then repeated transfers with that same
handle might not execute the same operation anymore!

This fixes the libcurl part of #5462

Test 1633 added to verify.

Closes #5499
2020-06-02 16:30:36 +02:00
Daniel Stenberg
c06ffdb6f1
test970: make it require proxy support
This test verifies the -w %json output and the test case includes a full
generated "blob". If there's no proxy support built into libcurl, it
will return an error for proxy related info variables and they will not
be included in the json, thus causing a mismatch and this test fails.

Reported-by: Marc Hörsken
Fixes #5501
Closes #5502
2020-06-02 10:39:15 +02:00
Daniel Stenberg
f3d501dc67
build: disable more code/data when built without proxy support
Added build to travis to verify

Closes #5466
2020-05-30 23:18:16 +02:00
Daniel Stenberg
c4e6968127
url: alloc the download buffer at transfer start
... and free it as soon as the transfer is done. It removes the extra
alloc when a new size is set with setopt() and reduces memory for unused
easy handles.

In addition: the closure_handle now doesn't use an allocated buffer at
all but the smallest supported size as a stack based one.

Closes #5472
2020-05-30 23:14:33 +02:00
Daniel Stenberg
ad829b21ae
url: accept "any length" credentials for proxy auth
They're only limited to the maximum string input restrictions, not to
256 bytes.

Added test 1178 to verify

Reported-by: Will Roberts
Fixes #5448
Closes #5449
2020-05-25 23:08:57 +02:00
Viktor Szakats
308c243db5
all: fix codespell errors
Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Closes https://github.com/curl/curl/pull/5452
2020-05-25 19:44:04 +00:00
Daniel Stenberg
006d2991bd
curl: remove -J "informational" written on stdout
curl would previously show "curl: Saved to filename 'name from header'"
if -J was used and a name was picked from the Content-Disposition
header. That output could interfer with other stdout output, such as -w.

This commit removes that output line.
Bug: https://curl.haxx.se/mail/archive-2020-05/0044.html
Reported-by: Коваленко Анатолий Викторович
Closes #5435
2020-05-23 23:12:53 +02:00
Daniel Stenberg
9e95ca10b5
test1632: verify FTP through HTTPS-proxy with connection re-use 2020-05-15 08:28:56 +02:00
Daniel Stenberg
c6ce51169e
test1631: verify FTP download through HTTPS-proxy 2020-05-15 08:28:56 +02:00
Daniel Stenberg
600a8cded4
url: make the updated credentials URL-encoded in the URL
Found-by: Gregory Jefferis
Reported-by: Jeroen Ooms
Added test 1168 to verify. Bug spotted when doing a redirect.
Bug: https://github.com/jeroen/curl/issues/224
Closes #5400
2020-05-14 17:59:47 +02:00
Daniel Stenberg
e2a7a6bb9e
tests: add https-proxy support to the test suite
Initial test 1630 added with basic HTTPS-proxy use. HTTPS-proxy is like
HTTP proxy but with a full TLS connection to the proxy.

Closes #5399
2020-05-14 16:21:31 +02:00
Daniel Stenberg
f3f5d82e28
docs/options-in-versions: which version added each cmdline option
Added test 971 to verify that the list is in sync with the files in
cmdline-opts. The check also verifies that .d-files that uses Added:
specify the same version number as the options-in-versions file does.

Closes #5381
2020-05-13 23:58:36 +02:00
Jay Satiro
b995bb58cb tool: Add option --retry-all-errors to retry on any error
The "sledgehammer" of retrying.

Closes https://github.com/curl/curl/pull/5185
2020-05-12 03:00:15 -04:00
Marc Hoersken
cffbcc3110
test1238: avoid tftpd being busy for tests shortly following
The tftpd server may still be busy if the total timeout of
25 seconds has not been reached or no sread error was received
during or after the execution of the timeout test 1238.

Once the next TFTP test comes around (eg. 1242 or 1243),
those will fail because the tftpd server is still waiting
on data from curl due to the UDP protocol being stateless
and having no connection close. On Linux this error may not
happen, because ICMP errors generated due to a swrite error
can also be returned async on the next sread call instead.

Therefore we will now just kill the tftpd server after test
1238 to make sure that the following tests are not affected.

This enables us to no longer ignore tests 1242, 1243, 2002
and 2003 on the CI platforms CirrusCI and AppVeyor.

Assisted-by: Peter Wu
Closes #5364
2020-05-11 19:59:19 +02:00
Marc Hoersken
2d1745fe2c
test613.pl: make tests 613 and 614 work with OpenSSH for Windows
OpenSSH for Windows shows group and other/world permissions as *,
because those concepts do not exist on Windows. It also does not
show the current or parent directory, so we just ignore those.

Reviewed-by: Daniel Stenberg
Closes #5328
2020-05-06 19:33:20 +02:00
Daniel Stenberg
ed35d6590e
dynbuf: introduce internal generic dynamic buffer functions
A common set of functions instead of many separate implementations for
creating buffers that can grow when appending data to them. Existing
functionality has been ported over.

In my early basic testing, the total number of allocations seem at
roughly the same amount as before, possibly a few less.

See docs/DYNBUF.md for a description of the API.

Closes #5300
2020-05-04 10:40:39 +02:00
Marc Hoersken
1abb087a9c
tests: add support for SSH server variant specific transfer paths
OpenSSH for Windows requires paths in the format of /C:/
instead of the pseudo-POSIX paths /cygdrive/c/ or just /c/

Reviewed-by: Daniel Stenberg
Closes #5298
2020-05-02 16:56:55 +02:00
Daniel Stenberg
f9c6febae2
tests: make test 1248 + 1249 use %NOLISTENPORT
... instead of a port of a non-running server so that it works
stand-alone.

Closes #5318
2020-05-02 15:47:34 +02:00
Dan Fandrich
49bbc4f09b test75: Remove precheck test
This has not been needed since commit 9fa42bed and often prevents it
from running at all with dynamic test ports.
2020-04-30 16:56:59 +02:00
Dan Fandrich
5f5a7b478a tests: Stop referring to server ports when they're not used
Several tests referred to specific server ports even when the test
didn't actually use that server or specify that it's needed. In such
cases, the test harness substitutes the text "[not running]" as the port
number which causes many such tests to fail due to the inability to
parse the URL.  These tests are changed to use %NOLISTENPORT which will
always be substituted correctly.
2020-04-30 16:00:31 +02:00
Daniel Stenberg
c069027139
conncache: various concept cleanups
More connection cache accesses are protected by locks.

CONNCACHE_* is a beter prefix for the connection cache lock macros.

Curl_attach_connnection: now called as soon as there's a connection
struct available and before the connection is added to the connection
cache.

Curl_disconnect: now assumes that the connection is already removed from
the connection cache.

Ref: #4915
Closes #5009
2020-04-30 14:27:54 +02:00
Kamil Dudka
68774da9ca test1177: look for curl.h in source directory
If we use a separate build directory, there is no copy of the header.

Closes #5310
2020-04-29 13:54:08 +02:00
Daniel Stenberg
75e8feb6fb
tests: make runtests check that disabled tests exists
... and error out if so. Removed '536' from DISABLED as there is no such
test file.

Closes #5288
2020-04-24 13:43:21 +02:00
Daniel Stenberg
1ae5860059
test1154: set a proper name 2020-04-24 08:56:46 +02:00
Jay Satiro
c0e139a60d transfer: Switch PUT to GET/HEAD on 303 redirect
Prior to this change if there was a 303 reply to a PUT request then
the subsequent request to respond to that redirect would also be a PUT.
It was determined that was most likely incorrect based on the language
of the RFCs. Basically 303 means "see other" resource, which implies it
is most likely not the same resource, therefore we should not try to PUT
to that different resource.

Refer to the discussions in #5237 and #5248 for more information.

Fixes https://github.com/curl/curl/issues/5237
Closes https://github.com/curl/curl/pull/5248
2020-04-22 17:56:17 -04:00
Daniel Stenberg
018dd775c8
tests: add %NOLISTENPORT and use it
The purpose with this variable is to provide a port number that is
reasonably likely to not have a listener on the local host so that tests
can try connect failures against it. It uses port 47 - "reserved"
according to IANA.

Updated six tests to use it instead of the previous different ports.

Assisted-by: Emil Engler
Closes #5270
2020-04-20 22:38:05 +02:00
Daniel Stenberg
5811beba39
mqtt: improve the state machine
To handle PUBLISH before SUBACK and more.

Updated the existing tests and added three new ones.

Reported-by: Christoph Krey
Bug: https://curl.haxx.se/mail/lib-2020-04/0021.html
Closes #5246
2020-04-20 08:09:33 +02:00
xquery
4d925eee0e ensure all references to ports are replaced by vars 2020-04-20 06:16:54 +02:00
xquery
aa98c66e50 add more alt-svc test coverage 2020-04-20 06:16:54 +02:00
Daniel Stenberg
d2969c7aee
test1247: use http server to get the port number set
Follow-up to 0f5db7b263
2020-04-20 00:53:08 +02:00
Patrick Monnerat
d7471c1369
mime: properly check Content-Type even if it has parameters
New test 669 checks this fix is effective.

Fixes #5256
Closes #5258
Reported-by: thanhchungbtc on github
2020-04-19 20:52:48 +02:00
Daniel Stenberg
003a7b5269
test1245: make it work with dynamic FTP server port 2020-04-18 23:57:57 +02:00
Daniel Stenberg
b1c7073a77
test1055: make it work with dynamic FTP port 2020-04-18 23:57:57 +02:00
Daniel Stenberg
85e727d434
test1028: make it run on dynamic FTP server port 2020-04-18 23:57:56 +02:00
Daniel Stenberg
f99b007cd8
test1056: work with dynamic HTTP ipv6 port 2020-04-18 22:48:24 +02:00
Daniel Stenberg
721f24d6fc
test1448: work with dynamic HTTP server port 2020-04-18 22:48:24 +02:00
Daniel Stenberg
d009bc2e56
tests: introduce preprocessed test cases
The runtests script now always performs variable replacement on the
entire test source file before the test gets executed, and saves the
updated version in a temporary file (log/test[num]) so that all test
case readers/servers can use that version (if present) and thus enjoy
the powers of test case variable substitution.

This is necessary to allow complete port number freedom.

Test 309 is updated to work with a non-fixed port number thanks to this.
2020-04-18 22:46:04 +02:00
Daniel Stenberg
5e2f4a33fe
tests: make 2006-2010 handle different port number lengths 2020-04-18 22:45:40 +02:00
Marc Hoersken
a6f7b2f2a4
test2043: use revoked.badssl.com instead of revoked.grc.com
The certificate of revoked.grc.com has expired on 2020-04-13.

Reviewed-by: Jay Satiro

Closes #5233
2020-04-14 17:51:31 +02:00
Daniel Stenberg
41f5b66a02
tests: add four MQTT tests 1190 - 1193 2020-04-14 13:04:10 +02:00
Daniel Stenberg
ac343fed7a
test1908: avoid using fixed port number in test data
Closes #5225
2020-04-13 01:05:01 +02:00
Jay Satiro
17c18fbc30 test1148: tolerate progress updates better (again)
- Ignore intermediate progress updates.

- Support locales that use a character other than period as decimal
  separator (eg 100,0%).

test1148 checks that the progress finishes at 100% and has the right
bar width. Prior to this change the test assumed that the only progress
reported for such a quick transfer was 100%, however in rare instances
(like in the CI where transfer time can slow considerably) there may be
intermediate updates. For example, below is stderrlog1148 from a failed
CI run with explicit \r and \n added (it is one line; broken up so that
it's easier to understand).

\r
\r##################################                                        48.3%
\r######################################################################## 100.0%
\n

Closes https://github.com/curl/curl/pull/5194
2020-04-11 02:51:50 -04:00
Daniel Stenberg
741cb81d09
tests: verify split initial HTTP requests with CURL_SMALLREQSEND
test1294: "split request" being when the entire request isn't sent in
the first go, and the remainder is sent in the PERFORM state. A GET
request is otherwise not sending anything during PERFORM.

test1295: same kind of split but with POST

Closes #5197
2020-04-08 08:14:32 +02:00
Daniel Stenberg
6bc1040d55
test1566: verify --etag-compare that gets a 304 back
Verifies the fix in #5183

Closes #5186
2020-04-05 11:15:20 +02:00
Kwon-Young Choi
a448a4ce26
curl: allow both --etag-compare and --etag-save with same file name
This change inverse the order of processing for the --etag-compare and
--etag-save option to process first --etag-compare. This in turn allows
to use the same file name to compare and save an etag.

The original behavior of not failing if the etag file does not exists is
conserved.

Fixes #5179
Closes #5180
2020-04-05 01:07:52 +02:00
Daniel Stenberg
a97d826f6d
test1177: verify that all the CURL_VERSION_ bits are documented 2020-03-29 23:29:26 +02:00
Michael Kaufmann
884de1a763 writeout_json: Fix data type issues
Load long values correctly (e.g. for http_code).

Use curl_off_t (not long) for:
- size_download (CURLINFO_SIZE_DOWNLOAD_T)
- size_upload (CURLINFO_SIZE_UPLOAD_T)

The unit for these values is bytes/second, not microseconds:
- speed_download (CURLINFO_SPEED_DOWNLOAD_T)
- speed_upload (CURLINFO_SPEED_UPLOAD_T)

Fixes #5131
Closes #5152
2020-03-27 23:32:25 +01:00
Daniel Stenberg
9a8b3b3e13
copyright: fix out-of-date copyright ranges and missing headers
Reported by the new script 'scripts/copyright.pl'. The script has a
regex whitelist for the files that don't need copyright headers.

Removed three (mostly usesless) README files from docs/

Closes #5141
2020-03-24 15:05:59 +01:00
Daniel Stenberg
c448c4840e
getinfo: provide CURLINFO_HEADER_SIZE and CURLINFO_REQUEST_SIZE override
To let debug-builds return fake values, like in test 970.

Ref: #5131
Closes #5136
2020-03-22 23:32:57 +01:00
Daniel Stenberg
9a7e62e7c3
test970: improve the test
- send more data to make problems more obvious
- don't start the data with minus, it makes diffs harder to read
- skip the headers in the stdout comparison
- save to a file name to also verify 'filename_effective'

Ref: #5131
2020-03-22 23:32:39 +01:00
Daniel Stenberg
ab18027d6c
tests: add test 430, 431 and 432 to verify the --config fix
Verify the fixes in 4e0b4fee4
2020-03-20 11:14:56 +01:00
Marc Hoersken
3d77d089a4
test2100: fix static port instead of dynamic value being used 2020-03-20 00:28:31 +01:00
Marc Hoersken
9c2aaf3d33
test970: fix static ip:port instead of dynamic values being used 2020-03-20 00:24:36 +01:00
Marc Hoersken
3c9066fce5
tests: make Python-based servers compatible with Python 2 and 3
Update smbserver.py and negtelnetserver.py to be compatible with
Python 3 while staying backwards-compatible to support Python 2.

Fix string encoding and handling of echoed and transferred data.

Tested with both Python 2.7.17 and Python 3.7.7

Reported-by: Daniel Stenberg
Assisted-by: Kamil Dudka
Reviewed-by: Marcel Raad

Fixes #5104
Closes #5110
2020-03-19 03:26:19 +01:00
Johannes Schindelin
5450428491 schannel: add "best effort" revocation check option
- Implement new option CURLSSLOPT_REVOKE_BEST_EFFORT and
  --ssl-revoke-best-effort to allow a "best effort" revocation check.

A best effort revocation check ignores errors that the revocation check
was unable to take place. The reasoning is described in detail below and
discussed further in the PR.

---

When running e.g. with Fiddler, the schannel backend fails with an
unhelpful error message:

	Unknown error (0x80092012) - The revocation function was unable
	to check revocation for the certificate.

Sadly, many enterprise users who are stuck behind MITM proxies suffer
the very same problem.

This has been discussed in plenty of issues:
https://github.com/curl/curl/issues/3727,
https://github.com/curl/curl/issues/264, for example.

In the latter, a Microsoft Edge developer even made the case that the
common behavior is to ignore issues when a certificate has no recorded
distribution point for revocation lists, or when the server is offline.
This is also known as "best effort" strategy and addresses the Fiddler
issue.

Unfortunately, this strategy was not chosen as the default for schannel
(and is therefore a backend-specific behavior: OpenSSL seems to happily
ignore the offline servers and missing distribution points).

To maintain backward-compatibility, we therefore add a new flag
(`CURLSSLOPT_REVOKE_BEST_EFFORT`) and a new option
(`--ssl-revoke-best-effort`) to select the new behavior.

Due to the many related issues Git for Windows and GitHub Desktop, the
plan is to make this behavior the default in these software packages.

The test 2070 was added to verify this behavior, adapted from 310.

Based-on-work-by: georgeok <giorgos.n.oikonomou@gmail.com>
Co-authored-by: Markus Olsson <j.markus.olsson@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>

Closes https://github.com/curl/curl/pull/4981
2020-03-18 03:23:39 -04:00
Daniel Stenberg
7631f2b752
test 970: verify --write-out '%{json}'
Makes curl_easy_getinfo() of "variable" numerical content instead return
the number set in the env variable `CURL_TIME`.

Makes curl_version() of "variable" textual content. This guarantees a
stable version string which can be tested against. Environment variable
`CURL_VERSION` defines the content.

Assisted-by: Mathias Gumz
2020-03-17 15:04:24 +01:00
Daniel Stenberg
8a2b36df5b
DISABLED: disable test 323
The test uses SRP to "a server not supporting it" but modern stunnel
versions will silently accept it and remain happy. The test is therefore
faulty.

I haven't figured out how to make stunnel explicitly reject SRP-using
connects.

Reported-by: Marc Hörsken
Fixes #5105
Closes #5113
2020-03-17 09:55:35 +01:00
Marc Hoersken
dda8babd07
tests: fix verification of stdout in test 1452 due to newline
Fixes test1452:41:1: error: missing </stdout> tag before </verify>
2020-03-15 23:17:01 +01:00
Marc Hoersken
4be2560e01
tests: remove python_dependencies for smbserver from our tree
Users of the SMB tests will have to install impacket manually.

Reasoning: our in-tree version of impacket was quite outdated
and only compatible with Python 2 which is already end-of-life.
Upgrading to Python 3 and a compatible impacket version would
require to import additional Python-only and CPython-extension
dependencies. This would have hindered portability enormously.

Closes #5094
2020-03-15 10:01:38 +01:00
Daniel Stenberg
fe8ba51209
server/getpart: make the "XML-parser" stricter
When extracting a <section> <part> and there's no </part> before
</section>, this now outputs an error and returns a wrong string to
make users spot the mistake.

Ref: #5070
Closes #5071
2020-03-13 11:03:42 +01:00
Dan Fandrich
c0fe3b3260 tests/data: Fix some XML formatting issues in test cases
This allows these test files to pass xmllint.
2020-03-11 10:33:03 +01:00
Marc Hoersken
fb6134427a
test1129: fix invalid case of closing XML-tag and Content-Length
Fixes #5070
Closes #5072
2020-03-10 22:38:56 +01:00
Marc Hoersken
f11b2cb62b
tests/data: fix static ip instead of dynamic value being used
Follow up to 94ced8e
2020-03-10 13:31:19 +01:00
Marc Hoersken
94ced8e368
tests/data: fix static ip:port instead of dynamic values being used
Closes #5065
2020-03-10 03:56:50 +01:00
Jim Fuller
e96fe70cab
sftp: fix segfault regression introduced by #4747
This fix adds a defensive check for the case where the char *name in
struct libssh2_knownhost is NULL

Fixes #5041
Closes #5062
2020-03-09 15:01:40 +01:00
Patrick Monnerat
e5b366c0b5
mime: fix the binary encoder to handle large data properly
New test 666 checks this is effective.
As upload buffer size is significant in this kind of tests, shorten it
in similar test 652.

Fixes #4860
Closes #4833
Reported-by: RuurdBeerstra on github
2020-03-07 23:26:15 +01:00
Patrick Monnerat
1e4cb333ef
mime: do not perform more than one read in a row
Input buffer filling may delay the data sending if data reads are slow.
To overcome this problem, file and callback data reads do not accumulate
in buffer anymore. All other data (memory data and mime framing) are
considered as fast and still concatenated in buffer.
As this may highly impact performance in terms of data overhead, an early
end of part data check is added to spare a read call.
When encoding a part's data, an encoder may require more bytes than made
available by a single read. In this case, the above rule does not apply
and reads are performed until the encoder is able to deliver some data.

Tests 643, 644, 645, 650 and 654 have been adapted to the output data
changes, with test data size reduced to avoid the boredom of long lists of
1-byte chunks in verification data.
New test 667 checks mimepost using single-byte read callback with encoder.
New test 668 checks the end of part data early detection.

Fixes #4826
Reported-by: MrdUkk on github
2020-03-07 23:26:00 +01:00
Patrick Monnerat
96972ec1c0
mime: latch last read callback status.
In case a read callback returns a status (pause, abort, eof,
error) instead of a byte count, drain the bytes read so far but
remember this status for further processing.
Takes care of not losing data when pausing, and properly resume a
paused mime structure when requested.
New tests 670-673 check unpausing cases, with easy or multi
interface and mime or form api.

Fixes #4813
Reported-by: MrdUkk on github
2020-03-07 23:26:00 +01:00
Jay Satiro
09aa807240 libssh: Fix matching user-specified MD5 hex key
Prior to this change a match would never be successful because it
was mistakenly coded to compare binary data from libssh to a
user-specified hex string (ie CURLOPT_SSH_HOST_PUBLIC_KEY_MD5).

Reported-by: fds242@users.noreply.github.com

Fixes https://github.com/curl/curl/issues/4971
Closes https://github.com/curl/curl/pull/4974
2020-03-07 03:06:11 -05:00
Daniel Stenberg
5494afac8f
tests: disable 962, 963 and 964 on Windows
These tests are also doing UTF-8 SMTP.

Follow-up to df207d2dd9
2020-03-02 14:44:46 +01:00
Steve Holme
df207d2dd9
tests: disable SMTP UTF-8 tests on Windows
Fixes #4988
Closes #4992
2020-03-02 08:29:11 +01:00
Daniel Stenberg
8cd4e6d81f
Revert "mime: latch last read callback status."
This reverts commit 87869e38d7.

Fixes #5014
Closes #5015
Reopens #4833
2020-03-02 08:07:49 +01:00
Daniel Stenberg
d7242f4757
Revert "mime: do not perform more than one read in a row"
This reverts commit ed0f357f7d.
2020-03-02 07:42:54 +01:00
Daniel Stenberg
e002f6c0cb
Revert "mime: fix the binary encoder to handle large data properly"
This reverts commit b2caaa0681.
2020-03-02 07:42:48 +01:00
Patrick Monnerat
b2caaa0681
mime: fix the binary encoder to handle large data properly
New test 666 checks this is effective.
As upload buffer size is significant in this kind of tests, shorten it
in similar test 652.

Fixes #4860
Reported-by: RuurdBeerstra on github
2020-03-02 00:00:59 +01:00
Patrick Monnerat
ed0f357f7d
mime: do not perform more than one read in a row
Input buffer filling may delay the data sending if data reads are slow.
To overcome this problem, file and callback data reads do not accumulate
in buffer anymore. All other data (memory data and mime framing) are
considered as fast and still concatenated in buffer.
As this may highly impact performance in terms of data overhead, an early
end of part data check is added to spare a read call.
When encoding a part's data, an encoder may require more bytes than made
available by a single read. In this case, the above rule does not apply
and reads are performed until the encoder is able to deliver some data.

Tests 643, 644, 645, 650 and 654 have been adapted to the output data
changes, with test data size reduced to avoid the boredom of long lists of
1-byte chunks in verification data.
New test 664 checks mimepost using single-byte read callback with encoder.
New test 665 checks the end of part data early detection.

Fixes #4826
Reported-by: MrdUkk on github
2020-03-02 00:00:58 +01:00
Patrick Monnerat
87869e38d7
mime: latch last read callback status.
In case a read callback returns a status (pause, abort, eof,
error) instead of a byte count, drain the bytes read so far but
remember this status for further processing.
Takes care of not losing data when pausing, and properly resume a
paused mime structure when requested.
New tests 670-673 check unpausing cases, with easy or multi
interface and mime or form api.

Fixes #4813
Reported-by: MrdUkk on github
Closes #4833
2020-03-02 00:00:50 +01:00
Daniel Stenberg
15f51474c8
http2: make pausing/unpausing set/clear local stream window
This reduces the HTTP/2 window size to 32 MB since libcurl might have to
buffer up to this amount of data in memory and yet we don't want it set
lower to potentially impact tranfer performance on high speed networks.

Requires nghttp2 commit b3f85e2daa629
(https://github.com/nghttp2/nghttp2/pull/1444) to work properly, to end
up in the next release after 1.40.0.

Fixes #4939
Closes #4940
2020-02-27 10:35:51 +01:00
Steve Holme
0922f76240
tests: Automatically deduce the tool name from the test case for unit tests
It is still possible to override the executable to run during the test,
using the <tool> tag, but this patch removes the requirement that the
tag must be present for unit tests.

It also removes the possibility of human error when existing test cases
are used as the basis for new tests, as recently witnessed in 81c37124.

Reviewed-by: Daniel Stenberg
Closes #4976
2020-02-27 00:51:49 +00:00
Steve Holme
d9e40f57de
test1323: Added the missing 'unit test' feature requirement in the test case 2020-02-27 00:51:49 +00:00
Daniel Stenberg
6375b205a9
http: added 417 response treatment
When doing a request with a body + Expect: 100-continue and the server
responds with a 417, the same request will be retried immediately
without the Expect: header.

Added test 357 to verify.

Also added a control instruction to tell the sws test server to not read
the request body if Expect: is present, which the new test 357 uses.

Reported-by: bramus on github
Fixes #4949
Closes #4964
2020-02-26 22:48:14 +01:00
Steve Holme
34a1ffb05f
smtp: Support the SMTPUTF8 extension for the EXPN command
Simply notify the server we support the SMTPUTF8 extension if it does.
2020-02-26 14:54:51 +00:00