From 9591ff123ded454d9c45c946c286123b4a1c0a5d Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 28 May 2026 09:23:27 +0200 Subject: [PATCH] tidy-up: add space around operators, where missing Closes #21793 --- .github/scripts/randcurl.pl | 4 ++-- .github/scripts/verify-examples.pl | 2 +- include/curl/curl.h | 4 ++-- scripts/checksrc.pl | 2 +- scripts/contributors.sh | 4 ++-- scripts/managen | 8 +++---- src/tool_cb_dbg.c | 2 +- tests/data/test1063 | 2 +- tests/ech_combos.py | 2 +- tests/ech_tests.sh | 2 +- tests/ftpserver.pl | 2 +- tests/http/scorecard.py | 36 +++++++++++++++--------------- tests/http/test_02_download.py | 26 ++++++++++----------- tests/http/test_07_upload.py | 28 +++++++++++------------ tests/http/test_08_caddy.py | 12 +++++----- tests/http/test_09_push.py | 6 ++--- tests/http/test_10_proxy.py | 8 +++---- tests/http/test_14_auth.py | 2 +- tests/http/test_16_info.py | 8 +++---- tests/http/test_17_ssl_use.py | 2 +- tests/http/test_18_methods.py | 6 ++--- tests/http/test_19_shutdown.py | 6 ++--- tests/http/test_30_vsftpd.py | 10 ++++----- tests/http/test_31_vsftpds.py | 12 +++++----- tests/http/test_32_ftps_vsftpd.py | 12 +++++----- tests/http/test_40_socks.py | 4 ++-- tests/http/test_50_scp.py | 8 +++---- tests/http/test_51_sftp.py | 8 +++---- tests/negtelnetserver.py | 4 ++-- tests/processhelp.pm | 4 ++-- tests/runtests.pl | 12 +++++----- tests/server/rtspd.c | 2 +- tests/test1276.pl | 4 ++-- tests/testutil.pm | 2 +- 34 files changed, 128 insertions(+), 128 deletions(-) diff --git a/.github/scripts/randcurl.pl b/.github/scripts/randcurl.pl index f9c24d90db..83fc0e795f 100755 --- a/.github/scripts/randcurl.pl +++ b/.github/scripts/randcurl.pl @@ -218,7 +218,7 @@ sub runconfig { } # run curl command lines using -K -my $end = time() + $seconds/2; +my $end = time() + $seconds / 2; my $c = 0; print "Running command lines\n"; do { @@ -228,7 +228,7 @@ do { print "$c command lines\n"; # run curl command lines -$end = time() + $seconds/2; +$end = time() + $seconds / 2; $c = 0; print "Running config lines\n"; do { diff --git a/.github/scripts/verify-examples.pl b/.github/scripts/verify-examples.pl index 007369b4ab..a23dc412f0 100755 --- a/.github/scripts/verify-examples.pl +++ b/.github/scripts/verify-examples.pl @@ -68,7 +68,7 @@ sub extract { print O "/* !checksrc! disable BANNEDFUNC all */\n"; # for fopen() print O "/* !checksrc! disable COPYRIGHT all */\n"; print O "/* !checksrc! disable UNUSEDIGNORE all */\n"; - printf O "#line %d \"$f\"\n", $iline+1; + printf O "#line %d \"$f\"\n", $iline + 1; } } elsif($syn == 2) { diff --git a/include/curl/curl.h b/include/curl/curl.h index c790760b88..31c1bfb988 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -252,7 +252,7 @@ typedef int (*curl_xferinfo_callback)(void *clientp, #ifndef CURL_MAX_READ_SIZE /* The maximum receive buffer size configurable via CURLOPT_BUFFERSIZE. */ -#define CURL_MAX_READ_SIZE (10*1024*1024) +#define CURL_MAX_READ_SIZE (10 * 1024 * 1024) #endif #ifndef CURL_MAX_WRITE_SIZE @@ -269,7 +269,7 @@ typedef int (*curl_xferinfo_callback)(void *clientp, /* The only reason to have a max limit for this is to avoid the risk of a bad server feeding libcurl with a never-ending header that causes reallocs infinitely */ -#define CURL_MAX_HTTP_HEADER (100*1024) +#define CURL_MAX_HTTP_HEADER (100 * 1024) #endif /* This is a magic return code for the write callback that, when returned, diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index 748941d5c9..64b1da9a85 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -754,7 +754,7 @@ sub scanfile { my $cond = $4; if($cond =~ / = /) { checkwarn("ASSIGNWITHINCONDITION", - $line, $pos+1, $file, $l, + $line, $pos + 1, $file, $l, "assignment within conditional expression"); } my $temp = $cond; diff --git a/scripts/contributors.sh b/scripts/contributors.sh index 44dce7e2ab..a3a11d5243 100755 --- a/scripts/contributors.sh +++ b/scripts/contributors.sh @@ -82,7 +82,7 @@ awk ' { if(length($0)) { num++; - n = sprintf("%s%s%s,", n, length(n)?" ":"", $0); + n = sprintf("%s%s%s,", n, length(n) ? " " : "", $0); #print n; if(length(n) > 77) { printf(" %s\n", p); @@ -93,7 +93,7 @@ awk ' } END { - pp=substr(p,1,length(p)-1); + pp = substr(p, 1, length(p) - 1); printf(" %s\n", pp); printf(" (%d contributors)\n", num); } diff --git a/scripts/managen b/scripts/managen index 554f4c984e..e9b5d6157e 100755 --- a/scripts/managen +++ b/scripts/managen @@ -89,8 +89,8 @@ my $colwidth=79; # max number of columns sub prefixline { my ($num) = @_; - print "\t" x ($num/8); - print ' ' x ($num%8); + print "\t" x ($num / 8); + print ' ' x ($num % 8); } sub justline { @@ -868,7 +868,7 @@ sub single { if($count == ($num -1)) { $sep = " and "; } - $mstr .= sprintf "%s$l", $mstr?$sep:""; + $mstr .= sprintf "%s$l", $mstr ? $sep : ""; $count++; } push @foot, overrides($standalone, @@ -1202,7 +1202,7 @@ sub listglobals { close(F); } for my $e (0 .. $#globalopts) { - $globals .= sprintf "%s--%s", $e?($globalopts[$e+1] ? ", " : " and "):"", + $globals .= sprintf "%s--%s", $e ? ($globalopts[$e + 1] ? ", " : " and ") : "", $globalopts[$e],; } } diff --git a/src/tool_cb_dbg.c b/src/tool_cb_dbg.c index c9c14e6d13..cd046dcbad 100644 --- a/src/tool_cb_dbg.c +++ b/src/tool_cb_dbg.c @@ -134,7 +134,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type, struct timeval tv; char timebuf[20]; /* largest signed 64-bit is: 9,223,372,036,854,775,807 - * max length in decimal: 1 + (6*3) = 19 + * max length in decimal: 1 + (6 * 3) = 19 * formatted via TRC_IDS_FORMAT_IDS_2 this becomes 2 + 19 + 1 + 19 + 2 = 43 * negative xfer-id are not printed, negative conn-ids use TRC_IDS_FORMAT_1 */ diff --git a/tests/data/test1063 b/tests/data/test1063 index 63a2949716..0e95511d27 100644 --- a/tests/data/test1063 +++ b/tests/data/test1063 @@ -21,7 +21,7 @@ Largefile Invalid large X- range on a file:// -# This range value is 2**32+7, which will be truncated to the valid value 7 +# This range value is 2**32 + 7, which will be truncated to the valid value 7 # if the large file support is not working correctly -r 4294967303- file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt diff --git a/tests/ech_combos.py b/tests/ech_combos.py index 586619be33..8b15eff41f 100755 --- a/tests/ech_combos.py +++ b/tests/ech_combos.py @@ -65,7 +65,7 @@ def CombinationRepetitionUtil(chosen, arr, badarr, index, chosen[index] = arr[start] # Current is excluded, replace it - # with next (Note that i+1 is passed, + # with next (Note that i + 1 is passed, # but index is not changed) CombinationRepetitionUtil(chosen, arr, badarr, index + 1, r, start, end) diff --git a/tests/ech_tests.sh b/tests/ech_tests.sh index 4de58e4bc5..e1246dae18 100755 --- a/tests/ech_tests.sh +++ b/tests/ech_tests.sh @@ -1090,7 +1090,7 @@ age_of_news=0 if [ -f "$LTOP"/bad_runs ]; then age_of_news=$(fileage "$LTOP"/bad_runs) # only consider news "new" if we have not mailed today - if ((age_of_news < 24*3600)); then + if ((age_of_news < 24 * 3600)); then itsnews="no" fi fi diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index a15c69e5fb..88533019c8 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -2567,7 +2567,7 @@ sub PASV_ftp { $p="1,2,3,4"; } sendcontrol sprintf("227 Entering Passive Mode ($p,%d,%d)\r\n", - int($pasvport/256), int($pasvport%256)); + int($pasvport / 256), int($pasvport % 256)); } else { # EPSV reply diff --git a/tests/http/scorecard.py b/tests/http/scorecard.py index 205b556f61..1326ce28ff 100644 --- a/tests/http/scorecard.py +++ b/tests/http/scorecard.py @@ -55,14 +55,14 @@ class ScoreCardError(Exception): class Card: @classmethod def fmt_ms(cls, tval): - return f'{int(tval*1000)} ms' if tval >= 0 else '--' + return f'{int(tval * 1000)} ms' if tval >= 0 else '--' @classmethod def fmt_size(cls, val): - if val >= (1024*1024*1024): - return f'{val / (1024*1024*1024):0.000f}GB' + if val >= (1024 * 1024 * 1024): + return f'{val / (1024 * 1024 * 1024):0.000f}GB' if val >= (1024 * 1024): - return f'{val / (1024*1024):0.000f}MB' + return f'{val / (1024 * 1024):0.000f}MB' if val >= 1024: return f'{val / 1024:0.000f}KB' return f'{val:0.000f}B' @@ -71,8 +71,8 @@ class Card: def fmt_mbs(cls, val): if val is None or val < 0: return '--' - if val >= (1024*1024): - return f'{val/(1024*1024):.3g} MB/s' + if val >= (1024 * 1024): + return f'{val / (1024 * 1024):.3g} MB/s' if val >= 1024: return f'{val / 1024:.3g} KB/s' return f'{val:.3g} B/s' @@ -81,10 +81,10 @@ class Card: def fmt_speed(cls, val): if val is None or val < 0: return '--' - if val >= (10*1024*1024): - return f'{(val/(1024*1024)):.3f} MB/s' - if val >= (10*1024): - return f'{val/1024:.3f} KB/s' + if val >= (10 * 1024 * 1024): + return f'{(val / (1024 * 1024)):.3f} MB/s' + if val >= (10 * 1024): + return f'{val / 1024:.3f} KB/s' return f'{val:.3f} B/s' @classmethod @@ -92,10 +92,10 @@ class Card: if val is None or val < 0: return '--' pct = ((val / limit) * 100) - 100 - if val >= (10*1024*1024): - return f'{(val/(1024*1024)):.3f} MB/s, {pct:+.1f}%' - if val >= (10*1024): - return f'{val/1024:.3f} KB/s, {pct:+.1f}%' + if val >= (10 * 1024 * 1024): + return f'{(val / (1024 * 1024)):.3f} MB/s, {pct:+.1f}%' + if val >= (10 * 1024): + return f'{val / 1024:.3f} KB/s, {pct:+.1f}%' return f'{val:.3f} B/s, {pct:+.1f}%' @classmethod @@ -260,9 +260,9 @@ class ScoreRunner: raise Exception(f'unrecognised limit-rate: {self._limit_rate}') self._limit_rate_num = float(m.group(1)) if m.group(3) == 'g': - self._limit_rate_num *= 1024*1024*1024 + self._limit_rate_num *= 1024 * 1024 * 1024 elif m.group(3) == 'm': - self._limit_rate_num *= 1024*1024 + self._limit_rate_num *= 1024 * 1024 elif m.group(3) == 'k': self._limit_rate_num *= 1024 elif m.group(3) == 'b': @@ -335,7 +335,7 @@ class ScoreRunner: self._make_docs_file(docs_dir=server_docs, fname=fname, fsize=fsize) self._make_docs_file(docs_dir=server_docs, - fname='reqs10.data', fsize=10*1024) + fname='reqs10.data', fsize=10 * 1024) def _check_downloads(self, r: ExecResult, count: int): error = '' @@ -636,7 +636,7 @@ class ScoreRunner: def requests(self, count: int, meta: Dict[str, Any]) -> Dict[str, Any]: url = f'https://{self.env.domain1}:{self.server_port}/reqs10.data' - fsize = 10*1024 + fsize = 10 * 1024 cols = ['size', 'total'] rows = [] mparallel = meta['request_parallels'] diff --git a/tests/http/test_02_download.py b/tests/http/test_02_download.py index dc51c25f52..6e1352ec3a 100644 --- a/tests/http/test_02_download.py +++ b/tests/http/test_02_download.py @@ -43,12 +43,12 @@ class TestDownload: def _class_scope(self, env, httpd): indir = httpd.docs_dir env.make_data_file(indir=indir, fname="data-0k", fsize=0) - env.make_data_file(indir=indir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024) - env.make_data_file(indir=indir, fname="data-10m", fsize=10*1024*1024) - env.make_data_file(indir=indir, fname="data-50m", fsize=50*1024*1024) - env.make_data_gzipbomb(indir=indir, fname="bomb-100m.txt", fsize=100*1024*1024) + env.make_data_file(indir=indir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=indir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=indir, fname="data-1m", fsize=1024 * 1024) + env.make_data_file(indir=indir, fname="data-10m", fsize=10 * 1024 * 1024) + env.make_data_file(indir=indir, fname="data-50m", fsize=50 * 1024 * 1024) + env.make_data_gzipbomb(indir=indir, fname="bomb-100m.txt", fsize=100 * 1024 * 1024) # download 1 file @pytest.mark.parametrize("proto", Env.http_protos()) @@ -275,7 +275,7 @@ class TestDownload: self.check_downloads(curl, srcfile, count) # download serial via lib client, pause/resume at different offsets - @pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000]) + @pytest.mark.parametrize("pause_offset", [0, 10 * 1024, 100 * 1023, 640000]) @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_21_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset): count = 2 @@ -293,7 +293,7 @@ class TestDownload: self.check_downloads(client, srcfile, count) # download via lib client, several at a time, pause/resume - @pytest.mark.parametrize("pause_offset", [100*1023]) + @pytest.mark.parametrize("pause_offset", [100 * 1023]) @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_22_lib_parallel_resume(self, env: Env, httpd, nghttpx, proto, pause_offset): count = 2 @@ -481,7 +481,7 @@ class TestDownload: assert False, f'download {dfile} differs:\n{diff}' # download via lib client, 1 at a time, pause/resume at different offsets - @pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000]) + @pytest.mark.parametrize("pause_offset", [0, 10 * 1024, 100 * 1023, 640000]) @pytest.mark.parametrize("proto", Env.http_protos()) def test_02_29_h2_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset): count = 2 @@ -688,7 +688,7 @@ class TestDownload: # download with looong urls @pytest.mark.parametrize("proto", Env.http_protos()) - @pytest.mark.parametrize("url_junk", [1024, 16*1024, 32*1024, 64*1024, 80*1024, 96*1024]) + @pytest.mark.parametrize("url_junk", [1024, 16 * 1024, 32 * 1024, 64 * 1024, 80 * 1024, 96 * 1024]) def test_02_36_looong_urls(self, env: Env, httpd, nghttpx, proto, url_junk): if proto == 'h3' and env.curl_uses_lib('quiche'): pytest.skip("quiche fails from 16k onwards") @@ -699,11 +699,11 @@ class TestDownload: if url_junk <= 1024: r.check_exit_code(0) r.check_response(http_status=200) - elif url_junk <= 16*1024: + elif url_junk <= 16 * 1024: r.check_exit_code(0) # server replies with 414, Request URL too long r.check_response(http_status=414) - elif url_junk <= 32*1024: + elif url_junk <= 32 * 1024: r.check_exit_code(0) # server replies with 414, Request URL too long r.check_response(http_status=414) @@ -716,7 +716,7 @@ class TestDownload: # h2 is unable to send such large headers (frame limits) r.check_exit_code(55) elif proto == 'h3': - if url_junk <= 64*1024: + if url_junk <= 64 * 1024: r.check_exit_code(0) # nghttpx reports 431 Request Header Field too Large r.check_response(http_status=431) diff --git a/tests/http/test_07_upload.py b/tests/http/test_07_upload.py index 49f5213aa1..fee50387c5 100644 --- a/tests/http/test_07_upload.py +++ b/tests/http/test_07_upload.py @@ -42,12 +42,12 @@ class TestUpload: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd, nghttpx): - env.make_data_file(indir=env.gen_dir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=env.gen_dir, fname="data-63k", fsize=63*1024) - env.make_data_file(indir=env.gen_dir, fname="data-64k", fsize=64*1024) - env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=env.gen_dir, fname="data-1m+", fsize=(1024*1024)+1) - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + env.make_data_file(indir=env.gen_dir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-63k", fsize=63 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-64k", fsize=64 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-1m+", fsize=(1024 * 1024) + 1) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) # upload small data, check that this is what was echoed @pytest.mark.parametrize("proto", Env.http_protos()) @@ -147,7 +147,7 @@ class TestUpload: @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_15_hx_put(self, env: Env, httpd, nghttpx, proto): count = 2 - upload_size = 128*1024 + upload_size = 128 * 1024 url = f'https://localhost:{env.https_port}/curltest/put' client = LocalClient(name='cli_hx_upload', env=env) if not client.exists(): @@ -161,7 +161,7 @@ class TestUpload: @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_16_hx_put_reuse(self, env: Env, httpd, nghttpx, proto): count = 2 - upload_size = 128*1024 + upload_size = 128 * 1024 url = f'https://localhost:{env.https_port}/curltest/put' client = LocalClient(name='cli_hx_upload', env=env) if not client.exists(): @@ -175,7 +175,7 @@ class TestUpload: @pytest.mark.parametrize("proto", Env.http_protos()) def test_07_17_hx_post_reuse(self, env: Env, httpd, nghttpx, proto): count = 2 - upload_size = 128*1024 + upload_size = 128 * 1024 url = f'https://localhost:{env.https_port}/curltest/echo' client = LocalClient(name='cli_hx_upload', env=env) if not client.exists(): @@ -519,7 +519,7 @@ class TestUpload: @pytest.mark.parametrize("httpcode", [301, 302, 307, 308]) def test_07_44_put_redir(self, env: Env, httpd, nghttpx, proto, httpcode): count = 1 - upload_size = 128*1024 + upload_size = 128 * 1024 url = f'https://localhost:{env.https_port}/curltest/put-redir-{httpcode}' client = LocalClient(name='cli_hx_upload', env=env) if not client.exists(): @@ -639,10 +639,10 @@ class TestUpload: @pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx") @pytest.mark.parametrize("proto,upload_size", [ pytest.param('http/1.1', 100, id='h1-small-body'), - pytest.param('http/1.1', 10*1024, id='h1-medium-body'), - pytest.param('http/1.1', 32*1024, id='h1-limited-body'), - pytest.param('h2', 10*1024, id='h2-medium-body'), - pytest.param('h2', 32*1024, id='h2-limited-body'), + pytest.param('http/1.1', 10 * 1024, id='h1-medium-body'), + pytest.param('http/1.1', 32 * 1024, id='h1-limited-body'), + pytest.param('h2', 10 * 1024, id='h2-medium-body'), + pytest.param('h2', 32 * 1024, id='h2-limited-body'), pytest.param('h3', 1024, id='h3-small-body'), pytest.param('h3', 1024 * 1024, id='h3-limited-body'), ]) diff --git a/tests/http/test_08_caddy.py b/tests/http/test_08_caddy.py index c7dd25a8eb..efee4bc48b 100644 --- a/tests/http/test_08_caddy.py +++ b/tests/http/test_08_caddy.py @@ -59,12 +59,12 @@ class TestCaddy: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, caddy): - self._make_docs_file(docs_dir=caddy.docs_dir, fname='data10k.data', fsize=10*1024) - self._make_docs_file(docs_dir=caddy.docs_dir, fname='data1.data', fsize=1024*1024) - self._make_docs_file(docs_dir=caddy.docs_dir, fname='data5.data', fsize=5*1024*1024) - self._make_docs_file(docs_dir=caddy.docs_dir, fname='data10.data', fsize=10*1024*1024) - self._make_docs_file(docs_dir=caddy.docs_dir, fname='data100.data', fsize=100*1024*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + self._make_docs_file(docs_dir=caddy.docs_dir, fname='data10k.data', fsize=10 * 1024) + self._make_docs_file(docs_dir=caddy.docs_dir, fname='data1.data', fsize=1024 * 1024) + self._make_docs_file(docs_dir=caddy.docs_dir, fname='data5.data', fsize=5 * 1024 * 1024) + self._make_docs_file(docs_dir=caddy.docs_dir, fname='data10.data', fsize=10 * 1024 * 1024) + self._make_docs_file(docs_dir=caddy.docs_dir, fname='data100.data', fsize=100 * 1024 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) # download 1 file @pytest.mark.parametrize("proto", Env.http_protos()) diff --git a/tests/http/test_09_push.py b/tests/http/test_09_push.py index 8f4714be07..386289b39e 100644 --- a/tests/http/test_09_push.py +++ b/tests/http/test_09_push.py @@ -40,9 +40,9 @@ class TestPush: push_dir = os.path.join(httpd.docs_dir, 'push') if not os.path.exists(push_dir): os.makedirs(push_dir) - env.make_data_file(indir=push_dir, fname="data1", fsize=1*1024) - env.make_data_file(indir=push_dir, fname="data2", fsize=1*1024) - env.make_data_file(indir=push_dir, fname="data3", fsize=1*1024) + env.make_data_file(indir=push_dir, fname="data1", fsize=1 * 1024) + env.make_data_file(indir=push_dir, fname="data2", fsize=1 * 1024) + env.make_data_file(indir=push_dir, fname="data3", fsize=1 * 1024) def httpd_configure(self, env, httpd): httpd.set_extra_config(env.domain1, [ diff --git a/tests/http/test_10_proxy.py b/tests/http/test_10_proxy.py index 89c66278d4..f81260a28f 100644 --- a/tests/http/test_10_proxy.py +++ b/tests/http/test_10_proxy.py @@ -45,11 +45,11 @@ class TestProxy: os.makedirs(push_dir) if env.have_nghttpx(): nghttpx_fwd.start_if_needed() - env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) indir = httpd.docs_dir - env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024) + env.make_data_file(indir=indir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=indir, fname="data-1m", fsize=1024 * 1024) def get_tunnel_proto_used(self, r: ExecResult): for line in r.trace_lines: diff --git a/tests/http/test_14_auth.py b/tests/http/test_14_auth.py index 288e7b5d28..7a1bc25c0f 100644 --- a/tests/http/test_14_auth.py +++ b/tests/http/test_14_auth.py @@ -37,7 +37,7 @@ class TestAuth: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd, nghttpx): - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) # download 1 file, not authenticated @pytest.mark.parametrize("proto", Env.http_protos()) diff --git a/tests/http/test_16_info.py b/tests/http/test_16_info.py index 5be5e31b92..977342eb55 100644 --- a/tests/http/test_16_info.py +++ b/tests/http/test_16_info.py @@ -38,10 +38,10 @@ class TestInfo: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd): indir = httpd.docs_dir - env.make_data_file(indir=indir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024) - env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100*1024) + env.make_data_file(indir=indir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=indir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=indir, fname="data-1m", fsize=1024 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100 * 1024) # download plain file @pytest.mark.parametrize("proto", Env.http_protos()) diff --git a/tests/http/test_17_ssl_use.py b/tests/http/test_17_ssl_use.py index 4a4dd0bf7e..0f3b2ccb62 100644 --- a/tests/http/test_17_ssl_use.py +++ b/tests/http/test_17_ssl_use.py @@ -64,7 +64,7 @@ class TestSSLUse: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd, nghttpx): - env.make_data_file(indir=httpd.docs_dir, fname="data-10k", fsize=10*1024) + env.make_data_file(indir=httpd.docs_dir, fname="data-10k", fsize=10 * 1024) def test_17_01_sslinfo_plain(self, env: Env, httpd): proto = 'http/1.1' diff --git a/tests/http/test_18_methods.py b/tests/http/test_18_methods.py index 0063470928..faa31a638e 100644 --- a/tests/http/test_18_methods.py +++ b/tests/http/test_18_methods.py @@ -37,9 +37,9 @@ class TestMethods: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd, nghttpx): indir = httpd.docs_dir - env.make_data_file(indir=indir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024) + env.make_data_file(indir=indir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=indir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=indir, fname="data-1m", fsize=1024 * 1024) # download 1 file @pytest.mark.parametrize("proto", Env.http_protos()) diff --git a/tests/http/test_19_shutdown.py b/tests/http/test_19_shutdown.py index d72ed5a2ec..4ed9ad27fb 100644 --- a/tests/http/test_19_shutdown.py +++ b/tests/http/test_19_shutdown.py @@ -39,9 +39,9 @@ class TestShutdown: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd): indir = httpd.docs_dir - env.make_data_file(indir=indir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024) - env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024) + env.make_data_file(indir=indir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=indir, fname="data-100k", fsize=100 * 1024) + env.make_data_file(indir=indir, fname="data-1m", fsize=1024 * 1024) # check with `tcpdump` that we see curl TCP RST packets @pytest.mark.skipif(condition=not Env.tcpdump(), reason="tcpdump not available") diff --git a/tests/http/test_30_vsftpd.py b/tests/http/test_30_vsftpd.py index 5991c45553..adbd6ecc59 100644 --- a/tests/http/test_30_vsftpd.py +++ b/tests/http/test_30_vsftpd.py @@ -64,13 +64,13 @@ class TestVsFTPD: os.makedirs(vsftpd.docs_dir) self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-0k', fsize=0) self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-1k', fsize=1024) - self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-10k', fsize=10*1024) - self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-1m', fsize=1024*1024) - self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-10m', fsize=10*1024*1024) + self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-10k', fsize=10 * 1024) + self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-1m', fsize=1024 * 1024) + self._make_docs_file(docs_dir=vsftpd.docs_dir, fname='data-10m', fsize=10 * 1024 * 1024) env.make_data_file(indir=env.gen_dir, fname="upload-0k", fsize=0) env.make_data_file(indir=env.gen_dir, fname="upload-1k", fsize=1024) - env.make_data_file(indir=env.gen_dir, fname="upload-100k", fsize=100*1024) - env.make_data_file(indir=env.gen_dir, fname="upload-1m", fsize=1024*1024) + env.make_data_file(indir=env.gen_dir, fname="upload-100k", fsize=100 * 1024) + env.make_data_file(indir=env.gen_dir, fname="upload-1m", fsize=1024 * 1024) def test_30_01_list_dir(self, env: Env, vsftpd: VsFTPD): curl = CurlClient(env=env) diff --git a/tests/http/test_31_vsftpds.py b/tests/http/test_31_vsftpds.py index 0f8f23e9b6..f36bb1715a 100644 --- a/tests/http/test_31_vsftpds.py +++ b/tests/http/test_31_vsftpds.py @@ -70,12 +70,12 @@ class TestVsFTPD: if not os.path.exists(vsftpds.docs_dir): os.makedirs(vsftpds.docs_dir) self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-1k', fsize=1024) - self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10k', fsize=10*1024) - self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-1m', fsize=1024*1024) - self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10m', fsize=10*1024*1024) + self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10k', fsize=10 * 1024) + self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-1m', fsize=1024 * 1024) + self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10m', fsize=10 * 1024 * 1024) env.make_data_file(indir=env.gen_dir, fname="upload-1k", fsize=1024) - env.make_data_file(indir=env.gen_dir, fname="upload-100k", fsize=100*1024) - env.make_data_file(indir=env.gen_dir, fname="upload-1m", fsize=1024*1024) + env.make_data_file(indir=env.gen_dir, fname="upload-100k", fsize=100 * 1024) + env.make_data_file(indir=env.gen_dir, fname="upload-1m", fsize=1024 * 1024) def test_31_01_list_dir(self, env: Env, vsftpds: VsFTPD): curl = CurlClient(env=env) @@ -191,7 +191,7 @@ class TestVsFTPD: line_length = 21 srcfile = os.path.join(env.gen_dir, docname) dstfile = os.path.join(vsftpds.docs_dir, docname) - env.make_data_file(indir=env.gen_dir, fname=docname, fsize=100*1024, + env.make_data_file(indir=env.gen_dir, fname=docname, fsize=100 * 1024, line_length=line_length) srcsize = os.path.getsize(srcfile) self._rmf(dstfile) diff --git a/tests/http/test_32_ftps_vsftpd.py b/tests/http/test_32_ftps_vsftpd.py index 5433081d98..19eec643c6 100644 --- a/tests/http/test_32_ftps_vsftpd.py +++ b/tests/http/test_32_ftps_vsftpd.py @@ -70,12 +70,12 @@ class TestFtpsVsFTPD: if not os.path.exists(vsftpds.docs_dir): os.makedirs(vsftpds.docs_dir) self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-1k', fsize=1024) - self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10k', fsize=10*1024) - self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-1m', fsize=1024*1024) - self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10m', fsize=10*1024*1024) + self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10k', fsize=10 * 1024) + self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-1m', fsize=1024 * 1024) + self._make_docs_file(docs_dir=vsftpds.docs_dir, fname='data-10m', fsize=10 * 1024 * 1024) env.make_data_file(indir=env.gen_dir, fname="upload-1k", fsize=1024) - env.make_data_file(indir=env.gen_dir, fname="upload-100k", fsize=100*1024) - env.make_data_file(indir=env.gen_dir, fname="upload-1m", fsize=1024*1024) + env.make_data_file(indir=env.gen_dir, fname="upload-100k", fsize=100 * 1024) + env.make_data_file(indir=env.gen_dir, fname="upload-1m", fsize=1024 * 1024) def test_32_01_list_dir(self, env: Env, vsftpds: VsFTPD): curl = CurlClient(env=env) @@ -204,7 +204,7 @@ class TestFtpsVsFTPD: line_length = 21 srcfile = os.path.join(env.gen_dir, docname) dstfile = os.path.join(vsftpds.docs_dir, docname) - env.make_data_file(indir=env.gen_dir, fname=docname, fsize=100*1024, + env.make_data_file(indir=env.gen_dir, fname=docname, fsize=100 * 1024, line_length=line_length) srcsize = os.path.getsize(srcfile) self._rmf(dstfile) diff --git a/tests/http/test_40_socks.py b/tests/http/test_40_socks.py index 0e1d117399..9702aa1110 100644 --- a/tests/http/test_40_socks.py +++ b/tests/http/test_40_socks.py @@ -49,8 +49,8 @@ class TestSocks: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, httpd): indir = httpd.docs_dir - env.make_data_file(indir=indir, fname="data-10m", fsize=10*1024*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + env.make_data_file(indir=indir, fname="data-10m", fsize=10 * 1024 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) @pytest.mark.parametrize("sproto", ['socks4', 'socks5']) def test_40_01_socks_http(self, env: Env, sproto, danted: Dante, httpd): diff --git a/tests/http/test_50_scp.py b/tests/http/test_50_scp.py index 409378a11e..5bfba23f33 100644 --- a/tests/http/test_50_scp.py +++ b/tests/http/test_50_scp.py @@ -41,10 +41,10 @@ class TestScp: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, sshd): - env.make_data_file(indir=sshd.home_dir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=sshd.home_dir, fname="data-10m", fsize=10*1024*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + env.make_data_file(indir=sshd.home_dir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=sshd.home_dir, fname="data-10m", fsize=10 * 1024 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) def test_50_01_insecure(self, env: Env, sshd: Sshd): curl = CurlClient(env=env) diff --git a/tests/http/test_51_sftp.py b/tests/http/test_51_sftp.py index 052c7ef469..76e8727b99 100644 --- a/tests/http/test_51_sftp.py +++ b/tests/http/test_51_sftp.py @@ -41,10 +41,10 @@ class TestSftp: @pytest.fixture(autouse=True, scope='class') def _class_scope(self, env, sshd): - env.make_data_file(indir=sshd.home_dir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=sshd.home_dir, fname="data-10m", fsize=10*1024*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10k", fsize=10*1024) - env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024) + env.make_data_file(indir=sshd.home_dir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=sshd.home_dir, fname="data-10m", fsize=10 * 1024 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10k", fsize=10 * 1024) + env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10 * 1024 * 1024) def test_51_01_insecure(self, env: Env, sshd: Sshd): curl = CurlClient(env=env) diff --git a/tests/negtelnetserver.py b/tests/negtelnetserver.py index c31fc033aa..ae0e3ae941 100755 --- a/tests/negtelnetserver.py +++ b/tests/negtelnetserver.py @@ -84,7 +84,7 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler): neg.send_wont("NAWS") # Get the data passed through the negotiator - data = neg.recv(4*1024) + data = neg.recv(4 * 1024) log.debug("Incoming data: %r", data) if VERIFIED_REQ.encode('utf-8') in data: @@ -106,7 +106,7 @@ class NegotiatingTelnetHandler(socketserver.BaseRequestHandler): # put some effort into making a clean socket shutdown # that does not give the client ECONNRESET self.request.settimeout(0.1) - self.request.recv(4*1024) + self.request.recv(4 * 1024) self.request.shutdown(socket.SHUT_RDWR) except IOError: diff --git a/tests/processhelp.pm b/tests/processhelp.pm index ee5fc52d6d..688c1808d2 100644 --- a/tests/processhelp.pm +++ b/tests/processhelp.pm @@ -342,8 +342,8 @@ sub killpid { @requested = sort({$a <=> $b} @requested); } for(my $i = scalar(@requested) - 2; $i >= 0; $i--) { - if($requested[$i] == $requested[$i+1]) { - splice @requested, $i+1, 1; + if($requested[$i] == $requested[$i + 1]) { + splice @requested, $i + 1, 1; } } diff --git a/tests/runtests.pl b/tests/runtests.pl index e6b343c815..cc8fa51b29 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -1928,11 +1928,11 @@ sub singletest_success { my $esttotal = $sofar/$count * $total; my $estleft = $esttotal - $sofar; my $timeleft=sprintf("remaining: %02d:%02d", - $estleft/60, - $estleft%60); + $estleft / 60, + $estleft % 60); my $took = $timevrfyend{$testnum} - $timeprepini{$testnum}; my $duration = sprintf("duration: %02d:%02d", - $sofar/60, $sofar%60); + $sofar / 60, $sofar % 60); if(!$automakestyle) { logmsg sprintf("OK (%-3d out of %-3d, %s, took %.3fs, %s)\n", $count, $total, $timeleft, $took, $duration); @@ -2613,7 +2613,7 @@ EOHELP } } elsif($ARGV[0] =~ /^to$/i) { - $fromnum = $number+1; + $fromnum = $number + 1; } elsif($ARGV[0] =~ /^!(\d+)/) { $fromnum = -1; @@ -2645,7 +2645,7 @@ if(!$randseed) { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); # seed of the month. December 2019 becomes 201912 - $randseed = ($year+1900)*100 + $mon+1; + $randseed = ($year + 1900) * 100 + $mon + 1; print "Using curl: $CURL\n"; open(my $curlvh, "-|", exerunner() . shell_quote($CURL) . " --version 2>$dev_null") || die "could not get curl version!"; @@ -3342,7 +3342,7 @@ if($executed) { logmsg "IGNORED: failed tests: $sorted\n"; } logmsg sprintf("TESTDONE: $ok tests out of $total reported OK: %d%%\n", - $ok/$total*100); + $ok / $total * 100); if($failed && ($ok != $total)) { my $failedsorted = numsortwords($failed); diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index 31820008f0..97b2ba40d9 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -76,7 +76,7 @@ struct rtspd_httprequest { - skip bytes. */ int rcmd; /* doing a special command, see defines above */ reqprot_t protocol; /* request protocol, HTTP or RTSP */ - int prot_version; /* HTTP or RTSP version (major*10 + minor) */ + int prot_version; /* HTTP or RTSP version (major * 10 + minor) */ bool pipelining; /* true if request is pipelined */ char *rtp_buffer; size_t rtp_buffersize; diff --git a/tests/test1276.pl b/tests/test1276.pl index 8732ca4b1e..bdd903953a 100755 --- a/tests/test1276.pl +++ b/tests/test1276.pl @@ -56,8 +56,8 @@ if(join("", @gen) ne join("", @file)) { $file[$i] =~ s/[\r\n]//g; if($gen[$i] ne $file[$i]) { printf "File: %u:%s\nGen: %u:%s\n", - $i+1, showline($file[$i]), - $i+1, showline($gen[$i]); + $i + 1, showline($file[$i]), + $i + 1, showline($gen[$i]); $e++; if($e > 10) { # only show 10 lines diff diff --git a/tests/testutil.pm b/tests/testutil.pm index f0a2679492..6e3322332e 100644 --- a/tests/testutil.pm +++ b/tests/testutil.pm @@ -164,7 +164,7 @@ sub subbase64 { # boundary. Then provide two alternatives. my $now = time(); my $d = ($1 * 24 * 3600) + $now + 30; - $d = int($d/60) * 60; + $d = int($d / 60) * 60; my $d2 = $d + 60; $$thing =~ s/%%DAYS%%/%alternatives[$d,$d2]/; }