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

2008 Commits

Author SHA1 Message Date
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