mirror of
https://github.com/curl/curl.git
synced 2026-07-24 02:07:17 +03:00
tidy-up: miscellaneous
- tool_bname: scope an include. - `endif` comments. - Markdown fixes. - comment tidy-ups. - whitespace, newlines, indent. Closes #20309
This commit is contained in:
parent
62ba3604dc
commit
ac6264366f
98 changed files with 829 additions and 863 deletions
|
|
@ -24,65 +24,65 @@
|
|||
|
||||
# scripts used in test cases
|
||||
TESTSCRIPTS = \
|
||||
test1119.pl \
|
||||
test1135.pl \
|
||||
test1139.pl \
|
||||
test1140.pl \
|
||||
test1165.pl \
|
||||
test1167.pl \
|
||||
test1173.pl \
|
||||
test1175.pl \
|
||||
test1177.pl \
|
||||
test1222.pl \
|
||||
test1275.pl \
|
||||
test1276.pl \
|
||||
test1477.pl \
|
||||
test1486.pl \
|
||||
test1488.pl \
|
||||
test1544.pl \
|
||||
test1707.pl \
|
||||
test745.pl \
|
||||
test971.pl
|
||||
test1119.pl \
|
||||
test1135.pl \
|
||||
test1139.pl \
|
||||
test1140.pl \
|
||||
test1165.pl \
|
||||
test1167.pl \
|
||||
test1173.pl \
|
||||
test1175.pl \
|
||||
test1177.pl \
|
||||
test1222.pl \
|
||||
test1275.pl \
|
||||
test1276.pl \
|
||||
test1477.pl \
|
||||
test1486.pl \
|
||||
test1488.pl \
|
||||
test1544.pl \
|
||||
test1707.pl \
|
||||
test745.pl \
|
||||
test971.pl
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
allversions.pm \
|
||||
appveyor.pm \
|
||||
azure.pm \
|
||||
devtest.pl \
|
||||
dictserver.py \
|
||||
directories.pm \
|
||||
ech_combos.py \
|
||||
ech_tests.sh \
|
||||
ftpserver.pl \
|
||||
getpart.pm \
|
||||
globalconfig.pm \
|
||||
http-server.pl \
|
||||
http2-server.pl \
|
||||
http3-server.pl \
|
||||
memanalyze.pl \
|
||||
memanalyzer.pm \
|
||||
negtelnetserver.py \
|
||||
nghttpx.conf \
|
||||
pathhelp.pm \
|
||||
processhelp.pm \
|
||||
requirements.txt \
|
||||
rtspserver.pl \
|
||||
runner.pm \
|
||||
runtests.pl \
|
||||
secureserver.pl \
|
||||
serverhelp.pm \
|
||||
servers.pm \
|
||||
smbserver.py \
|
||||
sshhelp.pm \
|
||||
sshserver.pl \
|
||||
testcurl.pl \
|
||||
testutil.pm \
|
||||
tftpserver.pl \
|
||||
util.py \
|
||||
valgrind.pm \
|
||||
valgrind.supp \
|
||||
$(TESTSCRIPTS)
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
allversions.pm \
|
||||
appveyor.pm \
|
||||
azure.pm \
|
||||
devtest.pl \
|
||||
dictserver.py \
|
||||
directories.pm \
|
||||
ech_combos.py \
|
||||
ech_tests.sh \
|
||||
ftpserver.pl \
|
||||
getpart.pm \
|
||||
globalconfig.pm \
|
||||
http-server.pl \
|
||||
http2-server.pl \
|
||||
http3-server.pl \
|
||||
memanalyze.pl \
|
||||
memanalyzer.pm \
|
||||
negtelnetserver.py \
|
||||
nghttpx.conf \
|
||||
pathhelp.pm \
|
||||
processhelp.pm \
|
||||
requirements.txt \
|
||||
rtspserver.pl \
|
||||
runner.pm \
|
||||
runtests.pl \
|
||||
secureserver.pl \
|
||||
serverhelp.pm \
|
||||
servers.pm \
|
||||
smbserver.py \
|
||||
sshhelp.pm \
|
||||
sshserver.pl \
|
||||
testcurl.pl \
|
||||
testutil.pm \
|
||||
tftpserver.pl \
|
||||
util.py \
|
||||
valgrind.pm \
|
||||
valgrind.supp \
|
||||
$(TESTSCRIPTS)
|
||||
|
||||
# we have two variables here to make sure DIST_SUBDIRS does not get 'unit'
|
||||
# added twice as then targets such as 'distclean' misbehave and try to
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ http
|
|||
Replaced internal headers with a blank one
|
||||
</name>
|
||||
<command>
|
||||
-H "Host;" -H "Accept;" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
-H "Host;" -H "Accept;" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ http
|
|||
HTTP with proxy authorization
|
||||
</name>
|
||||
<command>
|
||||
-U fake@user:loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong -x %HOSTIP:%HTTPPORT http://we.want.that.site.com/%TESTNUMBER
|
||||
-U fake@user:loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong -x %HOSTIP:%HTTPPORT http://we.want.that.site.com/%TESTNUMBER
|
||||
</command>
|
||||
<features>
|
||||
proxy
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ https-proxy
|
|||
HTTPS-proxy with Basic auth to HTTP without auth
|
||||
</name>
|
||||
<command>
|
||||
-U fake@user:loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong -x https://%HOSTIP:%HTTPSPROXYPORT http://we.want.that.site.com/%TESTNUMBER --proxy-insecure
|
||||
-U fake@user:loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong -x https://%HOSTIP:%HTTPSPROXYPORT http://we.want.that.site.com/%TESTNUMBER --proxy-insecure
|
||||
</command>
|
||||
<features>
|
||||
proxy
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ http
|
|||
HTTP GET with user and password
|
||||
</name>
|
||||
<command>
|
||||
-u fake:user http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
-u fake:user http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ http
|
|||
HTTP PUT from a file but enforce chunked transfer-encoding
|
||||
</name>
|
||||
<command>
|
||||
-T %LOGDIR/file%TESTNUMBER -H "Transfer-Encoding: chunked" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
-T %LOGDIR/file%TESTNUMBER -H "Transfer-Encoding: chunked" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
<file name="%LOGDIR/file%TESTNUMBER">
|
||||
just some tiny teeny contents
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ http
|
|||
HTTP POST with auth and contents but with content-length set to 0
|
||||
</name>
|
||||
<command>
|
||||
-d "fooo=mooo%AMPpooo=clue%AMPdoo=%20%20%20++++" -u "fake:-user" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
-d "fooo=mooo%AMPpooo=clue%AMPdoo=%20%20%20++++" -u "fake:-user" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="US-ASCII"?>
|
||||
<testcase>
|
||||
# Bang on RTP by
|
||||
# 1) giving an evil payload (with $)
|
||||
# 2) Giving evil content (SDP starting with $)
|
||||
# 3) packing rtp after headers, after content, and at the start
|
||||
# 1. giving an evil payload (with $)
|
||||
# 2. Giving evil content (SDP starting with $)
|
||||
# 3. packing rtp after headers, after content, and at the start
|
||||
<info>
|
||||
<keywords>
|
||||
RTSP
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ http
|
|||
HTTP POST with custom content-type
|
||||
</name>
|
||||
<command>
|
||||
-d "hejsanallabarn" -H "Content-Type: silly/type" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
-d "hejsanallabarn" -H "Content-Type: silly/type" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ http
|
|||
HTTP PUT from stdin with set size, disabling chunked transfer-encoding
|
||||
</name>
|
||||
<command>
|
||||
-T - -H "Transfer-Encoding:" -H "Content-Length: 14" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
-T - -H "Transfer-Encoding:" -H "Content-Length: 14" http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
<stdin>
|
||||
data on stdin
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ sub getpartattr {
|
|||
my %hash;
|
||||
my $inside=0;
|
||||
|
||||
# print "Section: $section, part: $part\n";
|
||||
# print "Section: $section, part: $part\n";
|
||||
|
||||
for(@xml) {
|
||||
# print "$inside: $_";
|
||||
# print "$inside: $_";
|
||||
if(!$inside && ($_ =~ /^ *\<$section/)) {
|
||||
$inside++;
|
||||
}
|
||||
|
|
@ -214,6 +214,7 @@ sub partexists {
|
|||
}
|
||||
return 0; # does not exist
|
||||
}
|
||||
|
||||
# The code currently never calls this more than once per part per file, so
|
||||
# caching a result that will never be used again just slows things down.
|
||||
# memoize('partexists', NORMALIZER => 'normalize_part'); # cache each result
|
||||
|
|
|
|||
|
|
@ -22,54 +22,54 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
TESTENV = \
|
||||
testenv/__init__.py \
|
||||
testenv/caddy.py \
|
||||
testenv/certs.py \
|
||||
testenv/client.py \
|
||||
testenv/curl.py \
|
||||
testenv/dante.py \
|
||||
testenv/env.py \
|
||||
testenv/httpd.py \
|
||||
testenv/mod_curltest/mod_curltest.c \
|
||||
testenv/nghttpx.py \
|
||||
testenv/ports.py \
|
||||
testenv/sshd.py \
|
||||
testenv/vsftpd.py \
|
||||
testenv/ws_echo_server.py
|
||||
TESTENV = \
|
||||
testenv/__init__.py \
|
||||
testenv/caddy.py \
|
||||
testenv/certs.py \
|
||||
testenv/client.py \
|
||||
testenv/curl.py \
|
||||
testenv/dante.py \
|
||||
testenv/env.py \
|
||||
testenv/httpd.py \
|
||||
testenv/mod_curltest/mod_curltest.c \
|
||||
testenv/nghttpx.py \
|
||||
testenv/ports.py \
|
||||
testenv/sshd.py \
|
||||
testenv/vsftpd.py \
|
||||
testenv/ws_echo_server.py
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
conftest.py \
|
||||
requirements.txt \
|
||||
scorecard.py \
|
||||
test_01_basic.py \
|
||||
test_02_download.py \
|
||||
test_03_goaway.py \
|
||||
test_04_stuttered.py \
|
||||
test_05_errors.py \
|
||||
test_06_eyeballs.py \
|
||||
test_07_upload.py \
|
||||
test_08_caddy.py \
|
||||
test_09_push.py \
|
||||
test_10_proxy.py \
|
||||
test_11_unix.py \
|
||||
test_12_reuse.py \
|
||||
test_13_proxy_auth.py \
|
||||
test_14_auth.py \
|
||||
test_15_tracing.py \
|
||||
test_16_info.py \
|
||||
test_17_ssl_use.py \
|
||||
test_18_methods.py \
|
||||
test_19_shutdown.py \
|
||||
test_20_websockets.py \
|
||||
test_30_vsftpd.py \
|
||||
test_31_vsftpds.py \
|
||||
test_32_ftps_vsftpd.py \
|
||||
test_40_socks.py \
|
||||
test_50_scp.py \
|
||||
test_51_sftp.py \
|
||||
$(TESTENV)
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
conftest.py \
|
||||
requirements.txt \
|
||||
scorecard.py \
|
||||
test_01_basic.py \
|
||||
test_02_download.py \
|
||||
test_03_goaway.py \
|
||||
test_04_stuttered.py \
|
||||
test_05_errors.py \
|
||||
test_06_eyeballs.py \
|
||||
test_07_upload.py \
|
||||
test_08_caddy.py \
|
||||
test_09_push.py \
|
||||
test_10_proxy.py \
|
||||
test_11_unix.py \
|
||||
test_12_reuse.py \
|
||||
test_13_proxy_auth.py \
|
||||
test_14_auth.py \
|
||||
test_15_tracing.py \
|
||||
test_16_info.py \
|
||||
test_17_ssl_use.py \
|
||||
test_18_methods.py \
|
||||
test_19_shutdown.py \
|
||||
test_20_websockets.py \
|
||||
test_30_vsftpd.py \
|
||||
test_31_vsftpds.py \
|
||||
test_32_ftps_vsftpd.py \
|
||||
test_40_socks.py \
|
||||
test_50_scp.py \
|
||||
test_51_sftp.py \
|
||||
$(TESTENV)
|
||||
|
||||
clean-local:
|
||||
rm -rf *.pyc __pycache__
|
||||
|
|
|
|||
|
|
@ -24,11 +24,10 @@
|
|||
#include "first.h"
|
||||
|
||||
/*
|
||||
* From "KNOWN_BUGS" April 2009:
|
||||
|
||||
59. If the CURLOPT_PORT option is used on an FTP URL like
|
||||
"ftp://example.com/file;type=A" the ";type=A" is stripped off.
|
||||
From "KNOWN_BUGS" April 2009:
|
||||
|
||||
59. If the CURLOPT_PORT option is used on an FTP URL like
|
||||
"ftp://example.com/file;type=A" the ";type=A" is stripped off.
|
||||
*/
|
||||
|
||||
static CURLcode test_lib562(const char *URL)
|
||||
|
|
|
|||
|
|
@ -72,7 +72,9 @@
|
|||
/*****************************************************************************
|
||||
* This is a rewrite/clone of the arpa/tftp.h file for systems without it. *
|
||||
*****************************************************************************/
|
||||
|
||||
#define SEGSIZE 512 /* data segment size */
|
||||
#define PKTSIZE (SEGSIZE + 4) /* SEGSIZE defined in arpa/tftp.h */
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 3) || \
|
||||
((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 7)))
|
||||
|
|
@ -108,8 +110,6 @@ struct tftphdr {
|
|||
* STRUCT DECLARATIONS AND DEFINES *
|
||||
*****************************************************************************/
|
||||
|
||||
#define PKTSIZE (SEGSIZE + 4) /* SEGSIZE defined in arpa/tftp.h */
|
||||
|
||||
struct testcase {
|
||||
char *buffer; /* holds the file data to send to the client */
|
||||
size_t bufsize; /* size of the data in buffer */
|
||||
|
|
|
|||
|
|
@ -35,34 +35,34 @@ static CURLcode t1609_setup(void)
|
|||
|
||||
/* CURLOPT_RESOLVE address parsing test - to test the following defect fix:
|
||||
|
||||
1) if there is already existing host:port pair in the DNS cache and
|
||||
we call CURLOPT_RESOLVE, it should also replace addresses.
|
||||
for example, if there is "test.com:80" with address "1.1.1.1"
|
||||
and we called CURLOPT_RESOLVE with address "2.2.2.2", then DNS entry needs to
|
||||
reflect that.
|
||||
1. if there is already existing host:port pair in the DNS cache and
|
||||
we call CURLOPT_RESOLVE, it should also replace addresses.
|
||||
for example, if there is "test.com:80" with address "1.1.1.1"
|
||||
and we called CURLOPT_RESOLVE with address "2.2.2.2", then DNS entry
|
||||
needs to reflect that.
|
||||
|
||||
2) when cached address is already there and close to expire, then by the
|
||||
time request is made, it can get expired. This happens because, when
|
||||
we set address using CURLOPT_RESOLVE,
|
||||
it usually marks as permanent (by setting timestamp to zero). However,
|
||||
if address already exists
|
||||
in the cache, then it does not mark it, but just leaves it as it is.
|
||||
So we fixing this by timestamp to zero if address already exists too.
|
||||
2. when cached address is already there and close to expire, then by the
|
||||
time request is made, it can get expired. This happens because, when
|
||||
we set address using CURLOPT_RESOLVE,
|
||||
it usually marks as permanent (by setting timestamp to zero). However,
|
||||
if address already exists
|
||||
in the cache, then it does not mark it, but just leaves it as it is.
|
||||
So we fixing this by timestamp to zero if address already exists too.
|
||||
|
||||
Test:
|
||||
Test:
|
||||
|
||||
- insert new entry
|
||||
- verify that timestamp is not zero
|
||||
- call set options with CURLOPT_RESOLVE
|
||||
- then, call Curl_loadhostpairs
|
||||
- insert new entry
|
||||
- verify that timestamp is not zero
|
||||
- call set options with CURLOPT_RESOLVE
|
||||
- then, call Curl_loadhostpairs
|
||||
|
||||
expected result: cached address has zero timestamp.
|
||||
expected result: cached address has zero timestamp.
|
||||
|
||||
- call set options with CURLOPT_RESOLVE with same host:port pair,
|
||||
different address.
|
||||
- then, call Curl_loadhostpairs
|
||||
- call set options with CURLOPT_RESOLVE with same host:port pair,
|
||||
different address.
|
||||
- then, call Curl_loadhostpairs
|
||||
|
||||
expected result: cached address has zero timestamp and new address
|
||||
expected result: cached address has zero timestamp and new address
|
||||
*/
|
||||
|
||||
static CURLcode test_unit1609(const char *arg)
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ static void check_set(const char *name, uint32_t capacity,
|
|||
for(i = 1; i < slen; ++i) {
|
||||
fail_unless(Curl_uint32_bset_next(&bset, n, &n), "next failed");
|
||||
if(n != s[i]) {
|
||||
curl_mfprintf(stderr, "expected next to be %u"
|
||||
", not %u\n", s[i], n);
|
||||
curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
|
||||
fail_unless(n == s[i], "next not correct number");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ static void check_spbset(const char *name, const uint32_t *s, size_t slen)
|
|||
for(i = 1; i < slen; ++i) {
|
||||
fail_unless(Curl_uint32_spbset_next(&bset, n, &n), "next failed");
|
||||
if(n != s[i]) {
|
||||
curl_mfprintf(stderr, "expected next to be %u"
|
||||
", not %u\n", s[i], n);
|
||||
curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
|
||||
fail_unless(n == s[i], "next not correct number");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue