diff options
Diffstat (limited to 'tests')
251 files changed, 4484 insertions, 1588 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index acd9caa00..63b4cda03 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(data) add_subdirectory(libtest) add_subdirectory(server) +add_subdirectory(unit) diff --git a/tests/FILEFORMAT b/tests/FILEFORMAT index a8e74b31e..04a6daeb7 100644 --- a/tests/FILEFORMAT +++ b/tests/FILEFORMAT @@ -181,6 +181,7 @@ http-unix https httptls+srp httptls+srp-ipv6 +http/2 imap none pop3 @@ -426,8 +427,9 @@ have a text/binary difference. Variables are substituted as in the <command> section. </file> <stripfile> -One perl op per line that operates on the file before being compared. This is -pretty advanced. Example: "s/^EPRT .*/EPRT stripped/" +One perl op per line that operates on the output file or stdout before being +compared with what is stored in the test file. This is pretty +advanced. Example: "s/^EPRT .*/EPRT stripped/" </stripfile> <upload> the contents of the upload data curl should have sent diff --git a/tests/Makefile.am b/tests/Makefile.am index 942ab8fb8..585d0171d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -25,9 +25,11 @@ PDFPAGES = testcurl.pdf runtests.pdf EXTRA_DIST = ftpserver.pl httpserver.pl secureserver.pl runtests.pl getpart.pm \ FILEFORMAT README stunnel.pem memanalyze.pl testcurl.pl valgrind.pm ftp.pm \ - sshserver.pl sshhelp.pm testcurl.1 runtests.1 $(HTMLPAGES) $(PDFPAGES) \ + sshserver.pl sshhelp.pm pathhelp.pm testcurl.1 runtests.1 \ + $(HTMLPAGES) $(PDFPAGES) \ serverhelp.pm tftpserver.pl rtspserver.pl directories.pm symbol-scan.pl \ - CMakeLists.txt mem-include-scan.pl valgrind.supp http_pipe.py extern-scan.pl + CMakeLists.txt mem-include-scan.pl valgrind.supp http_pipe.py extern-scan.pl \ + manpage-scan.pl nroff-scan.pl http2-server.pl DISTCLEANFILES = configurehelp.pm @@ -49,7 +51,7 @@ PERLFLAGS = -I$(srcdir) CLEANFILES = .http.pid .https.pid .ftp.pid .ftps.pid -MAN2HTML= roffit < $< >$@ +MAN2HTML= roffit $< >$@ curl: @cd $(top_builddir) && $(MAKE) @@ -92,3 +94,8 @@ torture-test: perlcheck all ps2pdf $$foo.ps $@; \ rm $$foo.ps; \ echo "converted $< to $@") + +checksrc: + cd libtest && $(MAKE) checksrc + cd unit && $(MAKE) checksrc + cd server && $(MAKE) checksrc diff --git a/tests/Makefile.in b/tests/Makefile.in index f4dbfdf90..13d33abc7 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -21,7 +21,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -411,9 +411,11 @@ HTMLPAGES = testcurl.html runtests.html PDFPAGES = testcurl.pdf runtests.pdf EXTRA_DIST = ftpserver.pl httpserver.pl secureserver.pl runtests.pl getpart.pm \ FILEFORMAT README stunnel.pem memanalyze.pl testcurl.pl valgrind.pm ftp.pm \ - sshserver.pl sshhelp.pm testcurl.1 runtests.1 $(HTMLPAGES) $(PDFPAGES) \ + sshserver.pl sshhelp.pm pathhelp.pm testcurl.1 runtests.1 \ + $(HTMLPAGES) $(PDFPAGES) \ serverhelp.pm tftpserver.pl rtspserver.pl directories.pm symbol-scan.pl \ - CMakeLists.txt mem-include-scan.pl valgrind.supp http_pipe.py extern-scan.pl + CMakeLists.txt mem-include-scan.pl valgrind.supp http_pipe.py extern-scan.pl \ + manpage-scan.pl nroff-scan.pl http2-server.pl DISTCLEANFILES = configurehelp.pm @BUILD_UNITTESTS_FALSE@BUILD_UNIT = @@ -428,7 +430,7 @@ SUBDIRS = certs data server libtest $(BUILD_UNIT) DIST_SUBDIRS = $(SUBDIRS) $(DIST_UNIT) PERLFLAGS = -I$(srcdir) CLEANFILES = .http.pid .https.pid .ftp.pid .ftps.pid -MAN2HTML = roffit < $< >$@ +MAN2HTML = roffit $< >$@ @CROSSCOMPILING_FALSE@TEST = srcdir=$(srcdir) $(PERL) $(PERLFLAGS) $(srcdir)/runtests.pl @CROSSCOMPILING_TRUE@TEST = @echo "NOTICE: we can't run the tests when cross-compiling!" @CROSSCOMPILING_FALSE@TEST_Q = -a -s @@ -782,6 +784,11 @@ torture-test: perlcheck all rm $$foo.ps; \ echo "converted $< to $@") +checksrc: + cd libtest && $(MAKE) checksrc + cd unit && $(MAKE) checksrc + cd server && $(MAKE) checksrc + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/tests/README b/tests/README index ae8ff25cc..834be63a5 100644 --- a/tests/README +++ b/tests/README @@ -43,6 +43,7 @@ The cURL Test Suite diff (when a test fails, a diff is shown) stunnel (for HTTPS and FTPS tests) OpenSSH or SunSSH (for SCP, SFTP and SOCKS4/5 tests) + nghttpx (for HTTP/2 tests) 1.2 Port numbers used by test servers diff --git a/tests/data/Makefile.in b/tests/data/Makefile.in index 91617350f..286e763ad 100644 --- a/tests/data/Makefile.in +++ b/tests/data/Makefile.in @@ -21,7 +21,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -373,7 +373,7 @@ test181 test182 test183 test184 test185 test186 test187 test188 test189 \ test190 test191 test192 test193 test194 test195 test196 test197 test198 \ test199 test200 test201 test202 test203 test204 test205 test206 test207 \ test208 test209 test210 test211 test212 test213 test214 test215 test216 \ -test217 test218 test220 test221 test222 test223 test224 test225 \ +test217 test218 test219 test220 test221 test222 test223 test224 test225 \ test226 test227 test228 test229 test231 test233 test234 \ test235 test236 test237 test238 test239 test240 test241 test242 test243 \ test245 test246 test247 test248 test249 test250 test251 test252 \ @@ -448,18 +448,19 @@ test1104 test1105 test1106 test1107 test1108 test1109 test1110 test1111 \ test1112 test1113 test1114 test1115 test1116 test1117 test1118 test1119 \ test1120 test1121 test1122 test1123 test1124 test1125 test1126 test1127 \ test1128 test1129 test1130 test1131 test1132 test1133 test1134 test1135 \ -test1136 test1137 test1138 \ -\ +test1136 test1137 test1138 test1139 test1140 test1141 test1142 test1143 \ +test1144 \ test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \ test1216 test1217 test1218 test1219 \ test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \ test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \ test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \ +test1244 \ \ test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \ test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \ -test1316 test1317 test1318 test1319 test1320 test1321 \ +test1316 test1317 test1318 test1319 test1320 test1321 test1322 \ test1325 test1326 test1327 test1328 test1329 test1330 test1331 \ test1332 test1333 test1334 test1335 test1336 test1337 test1338 test1339 \ test1340 test1341 test1342 test1343 test1344 test1345 test1346 test1347 \ @@ -480,7 +481,7 @@ test1436 test1437 \ \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \ -test1516 \ +test1516 test1517 \ \ test1520 \ \ @@ -488,6 +489,8 @@ test1525 test1526 test1527 test1528 test1529 test1530 test1531 \ \ test1600 test1601 test1602 test1603 test1604 \ \ +test1700 test1701 test1702 \ +\ test1800 test1801 \ \ test1900 test1901 test1902 test1903 \ @@ -498,7 +501,7 @@ test2016 test2017 test2018 test2019 test2020 test2021 test2022 test2023 \ test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \ test2032 test2033 test2034 test2035 test2036 test2037 test2038 test2039 \ test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 \ -test2048 +test2048 test2049 test2050 test2051 test2052 # TESTCASES are taken from Makefile.inc diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index a13aac9b9..6673bb75b 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -44,7 +44,7 @@ test181 test182 test183 test184 test185 test186 test187 test188 test189 \ test190 test191 test192 test193 test194 test195 test196 test197 test198 \ test199 test200 test201 test202 test203 test204 test205 test206 test207 \ test208 test209 test210 test211 test212 test213 test214 test215 test216 \ -test217 test218 test220 test221 test222 test223 test224 test225 \ +test217 test218 test219 test220 test221 test222 test223 test224 test225 \ test226 test227 test228 test229 test231 test233 test234 \ test235 test236 test237 test238 test239 test240 test241 test242 test243 \ test245 test246 test247 test248 test249 test250 test251 test252 \ @@ -119,18 +119,19 @@ test1104 test1105 test1106 test1107 test1108 test1109 test1110 test1111 \ test1112 test1113 test1114 test1115 test1116 test1117 test1118 test1119 \ test1120 test1121 test1122 test1123 test1124 test1125 test1126 test1127 \ test1128 test1129 test1130 test1131 test1132 test1133 test1134 test1135 \ -test1136 test1137 test1138 \ -\ +test1136 test1137 test1138 test1139 test1140 test1141 test1142 test1143 \ +test1144 \ test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \ test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \ test1216 test1217 test1218 test1219 \ test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \ test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \ test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \ +test1244 \ \ test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \ test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \ -test1316 test1317 test1318 test1319 test1320 test1321 \ +test1316 test1317 test1318 test1319 test1320 test1321 test1322 \ test1325 test1326 test1327 test1328 test1329 test1330 test1331 \ test1332 test1333 test1334 test1335 test1336 test1337 test1338 test1339 \ test1340 test1341 test1342 test1343 test1344 test1345 test1346 test1347 \ @@ -151,7 +152,7 @@ test1436 test1437 \ \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ test1508 test1509 test1510 test1511 test1512 test1513 test1514 test1515 \ -test1516 \ +test1516 test1517 \ \ test1520 \ \ @@ -159,6 +160,8 @@ test1525 test1526 test1527 test1528 test1529 test1530 test1531 \ \ test1600 test1601 test1602 test1603 test1604 \ \ +test1700 test1701 test1702 \ +\ test1800 test1801 \ \ test1900 test1901 test1902 test1903 \ @@ -169,4 +172,4 @@ test2016 test2017 test2018 test2019 test2020 test2021 test2022 test2023 \ test2024 test2025 test2026 test2027 test2028 test2029 test2030 test2031 \ test2032 test2033 test2034 test2035 test2036 test2037 test2038 test2039 \ test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 \ -test2048 +test2048 test2049 test2050 test2051 test2052 diff --git a/tests/data/test1001 b/tests/data/test1001 index 60e68a894..91b13203e 100644 --- a/tests/data/test1001 +++ b/tests/data/test1001 @@ -89,6 +89,7 @@ Host: %HOSTIP:%HTTPPORT Content-Range: bytes 2-4/5
User-Agent: curl/7.12.1-CVS (i686-pc-linux-gnu) libcurl/7.12.1-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.6
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
GET http://%HOSTIP:%HTTPPORT/1001 HTTP/1.1
@@ -96,6 +97,7 @@ Host: %HOSTIP:%HTTPPORT Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1001", response="6af4d89c952f4dd4cc215a6878dc499d"
Content-Range: bytes 2-4/5
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 3
Expect: 100-continue
diff --git a/tests/data/test1002 b/tests/data/test1002 index 83b87b9e4..83cce6e44 100644 --- a/tests/data/test1002 +++ b/tests/data/test1002 @@ -88,6 +88,7 @@ Host: %HOSTIP:%HTTPPORT Content-Range: bytes 2-4/5
User-Agent: curl/7.12.1-CVS (i686-pc-linux-gnu) libcurl/7.12.1-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.6
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
GET http://%HOSTIP:%HTTPPORT/1002.upload1 HTTP/1.1
@@ -95,6 +96,7 @@ Host: %HOSTIP:%HTTPPORT Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/1002.upload1", response="198aa9b6acb4b0c71d02a197a5e41f54"
Content-Range: bytes 2-4/5
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 3
Expect: 100-continue
@@ -105,6 +107,7 @@ Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", u Content-Range: bytes 2-4/5
User-Agent: curl/7.16.1
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 3
Expect: 100-continue
diff --git a/tests/data/test1008 b/tests/data/test1008 index 1dac3956f..bcc503e5a 100644 --- a/tests/data/test1008 +++ b/tests/data/test1008 @@ -114,10 +114,12 @@ chkhostname curlhost CONNECT test.remote.example.com.1008:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.1008:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
+Proxy-Connection: Keep-Alive
CONNECT test.remote.example.com.1008:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.1008:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
+Proxy-Connection: Keep-Alive
GET /path/10080002 HTTP/1.1
User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4
diff --git a/tests/data/test1021 b/tests/data/test1021 index 3bd64bdd3..3ac9e12e6 100644 --- a/tests/data/test1021 +++ b/tests/data/test1021 @@ -119,14 +119,17 @@ chkhostname curlhost <protocol> CONNECT test.remote.example.com.1021:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.1021:%HTTPPORT
+Proxy-Connection: Keep-Alive
CONNECT test.remote.example.com.1021:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.1021:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
+Proxy-Connection: Keep-Alive
CONNECT test.remote.example.com.1021:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.1021:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
+Proxy-Connection: Keep-Alive
GET /path/10210002 HTTP/1.1
User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4
diff --git a/tests/data/test1034 b/tests/data/test1034 index f14268497..c47574051 100644 --- a/tests/data/test1034 +++ b/tests/data/test1034 @@ -55,6 +55,7 @@ http://invalid-utf8-â.local/page/1034 -x %HOSTIP:%HTTPPORT GET http://invalid-utf8-â.local/page/1034 HTTP/1.1
Host: invalid-utf8-â.local
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1035 b/tests/data/test1035 index e1c2af637..20b434c34 100644 --- a/tests/data/test1035 +++ b/tests/data/test1035 @@ -52,6 +52,7 @@ http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/1035 GET http://too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local/page/1035 HTTP/1.1
Host: too-long-IDN-name-cürl-rüles-la-la-la-dee-da-flooby-nooby.local
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1059 b/tests/data/test1059 index ee4e6a78a..6820ea679 100644 --- a/tests/data/test1059 +++ b/tests/data/test1059 @@ -51,6 +51,7 @@ ftp://test-number:1059/wanted/page -p -x %HOSTIP:%HTTPPORT <protocol> CONNECT test-number:1059 HTTP/1.1
Host: test-number:1059
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1060 b/tests/data/test1060 index 1094792af..e4aea6589 100644 --- a/tests/data/test1060 +++ b/tests/data/test1060 @@ -887,10 +887,12 @@ http://test.remote.haxx.se.1060:8990/path/10600002 --proxy http://%HOSTIP:%HTTPP <protocol> CONNECT test.remote.haxx.se.1060:8990 HTTP/1.1
Host: test.remote.haxx.se.1060:8990
+Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se.1060:8990 HTTP/1.1
Host: test.remote.haxx.se.1060:8990
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se.1060:8990", response="e1fbed39c26f4efe284adc0e576ff638"
+Proxy-Connection: Keep-Alive
GET /path/10600002 HTTP/1.1
Host: test.remote.haxx.se.1060:8990
diff --git a/tests/data/test1061 b/tests/data/test1061 index 4f53a87a9..a55a27295 100644 --- a/tests/data/test1061 +++ b/tests/data/test1061 @@ -892,10 +892,12 @@ http://test.remote.haxx.se.1061:8990/path/10610002 --proxy http://%HOSTIP:%HTTPP <protocol> CONNECT test.remote.haxx.se.1061:8990 HTTP/1.1
Host: test.remote.haxx.se.1061:8990
+Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se.1061:8990 HTTP/1.1
Host: test.remote.haxx.se.1061:8990
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se.1061:8990", response="4e23449fa93224834299e7282a70472c"
+Proxy-Connection: Keep-Alive
GET /path/10610002 HTTP/1.1
Host: test.remote.haxx.se.1061:8990
diff --git a/tests/data/test1077 b/tests/data/test1077 index e71d75694..a3c90245a 100644 --- a/tests/data/test1077 +++ b/tests/data/test1077 @@ -30,6 +30,7 @@ Server: test-server/fake Content-Type: text/plain
Content-Length: 9
Funny-head: yesyes
+Proxy-Connection: Keep-Alive
contents </data2> @@ -62,10 +63,12 @@ FTP over HTTP proxy with downgrade to HTTP 1.0 GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/1077 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/10770002 HTTP/1.0
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1078 b/tests/data/test1078 index f04bad36f..a9bb771be 100644 --- a/tests/data/test1078 +++ b/tests/data/test1078 @@ -56,6 +56,7 @@ HTTP 1.0 CONNECT with proxytunnel and downgrade GET to HTTP/1.0 <proxy> CONNECT %HOSTIP.1078:%HTTPPORT HTTP/1.0
Host: %HOSTIP.1078:%HTTPPORT
+Proxy-Connection: Keep-Alive
</proxy> <protocol> diff --git a/tests/data/test1087 b/tests/data/test1087 index 1fb13cbef..d228976ac 100644 --- a/tests/data/test1087 +++ b/tests/data/test1087 @@ -92,15 +92,18 @@ http://first.host.it.is/we/want/that/page/10871000 -x %HOSTIP:%HTTPPORT --user i GET http://first.host.it.is/we/want/that/page/10871000 HTTP/1.1
Host: first.host.it.is
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://first.host.it.is/we/want/that/page/10871000 HTTP/1.1
Host: first.host.it.is
Authorization: Basic aWFtOm15c2VsZg==
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://goto.second.host.now/10871002 HTTP/1.1
Host: goto.second.host.now
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1088 b/tests/data/test1088 index 9801fff14..a807ce9e5 100644 --- a/tests/data/test1088 +++ b/tests/data/test1088 @@ -93,16 +93,19 @@ http://first.host.it.is/we/want/that/page/10881000 -x %HOSTIP:%HTTPPORT --user i GET http://first.host.it.is/we/want/that/page/10881000 HTTP/1.1
Host: first.host.it.is
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://first.host.it.is/we/want/that/page/10881000 HTTP/1.1
Host: first.host.it.is
Authorization: Basic aWFtOm15c2VsZg==
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://goto.second.host.now/10881002 HTTP/1.1
Host: goto.second.host.now
Authorization: Basic aWFtOm15c2VsZg==
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1092 b/tests/data/test1092 index ce843f000..adef4320b 100644 --- a/tests/data/test1092 +++ b/tests/data/test1092 @@ -49,6 +49,7 @@ FTP with type=i over HTTP proxy GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/1092;type=i HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1097 b/tests/data/test1097 index 81ea8552d..3b733a55a 100644 --- a/tests/data/test1097 +++ b/tests/data/test1097 @@ -67,6 +67,7 @@ CONNECT test.a.galaxy.far.far.away.1097:%HTTPPORT HTTP/1.1 Host: test.a.galaxy.far.far.away.1097:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.19.5-CVS (i686-pc-linux-gnu) libcurl/7.19.5-CVS OpenSSL/0.9.8g zlib/1.2.3.3 c-ares/1.6.1-CVS libidn/1.12 libssh2/1.0.1_CVS
+Proxy-Connection: Keep-Alive
POST /1097 HTTP/1.1
User-Agent: curl/7.19.5-CVS (i686-pc-linux-gnu) libcurl/7.19.5-CVS OpenSSL/0.9.8g zlib/1.2.3.3 c-ares/1.6.1-CVS libidn/1.12 libssh2/1.0.1_CVS
diff --git a/tests/data/test1098 b/tests/data/test1098 index 70a6f3913..980564810 100644 --- a/tests/data/test1098 +++ b/tests/data/test1098 @@ -49,10 +49,12 @@ ftp://ftp-site/moo/1098 ftp://ftp-site/moo/1098 --proxy http://%HOSTIP:%HTTPPORT GET ftp://ftp-site/moo/1098 HTTP/1.1
Host: ftp-site:21
Accept: */*
+Proxy-Connection: Keep-Alive
GET ftp://ftp-site/moo/1098 HTTP/1.1
Host: ftp-site:21
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <stdout> diff --git a/tests/data/test1104 b/tests/data/test1104 index 4df81a1a2..21efe3c15 100644 --- a/tests/data/test1104 +++ b/tests/data/test1104 @@ -72,10 +72,12 @@ http://%HOSTIP:%HTTPPORT/want/1104 -L -x %HOSTIP:%HTTPPORT -c log/cookies.jar GET http://%HOSTIP:%HTTPPORT/want/1104 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://%HOSTIP:%HTTPPORT/want/data/11040002 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
Cookie: test2=true
</protocol> diff --git a/tests/data/test1106 b/tests/data/test1106 index a2adbbb3f..0c6bec177 100644 --- a/tests/data/test1106 +++ b/tests/data/test1106 @@ -50,6 +50,7 @@ ftp://%HOSTIP:23456/1106 GET ftp://%HOSTIP:23456/1106 HTTP/1.1
Host: %HOSTIP:23456
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1139 b/tests/data/test1139 new file mode 100644 index 000000000..30f730c2e --- /dev/null +++ b/tests/data/test1139 @@ -0,0 +1,26 @@ +<testcase> +<info> +<keywords> +source analysis +symbols-in-versions +documentation +</keywords> +</info> + +# +# Client-side +<client> +<server> +none +</server> + + <name> +Verify that all libcurl options have man pages + </name> + +<command type="perl"> +%SRCDIR/manpage-scan.pl %SRCDIR/.. +</command> +</client> + +</testcase> diff --git a/tests/data/test1140 b/tests/data/test1140 new file mode 100644 index 000000000..b9458be9f --- /dev/null +++ b/tests/data/test1140 @@ -0,0 +1,26 @@ +<testcase> +<info> +<keywords> +source analysis +symbols-in-versions +documentation +</keywords> +</info> + +# +# Client-side +<client> +<server> +none +</server> + + <name> +Verify the nroff of man pages + </name> + +<command type="perl"> +%SRCDIR/nroff-scan.pl %SRCDIR/../docs/ %SRCDIR/../docs/libcurl/*.3 %SRCDIR/../docs/libcurl/opts/*.3 %SRCDIR/../docs/*.1 +</command> +</client> + +</testcase> diff --git a/tests/data/test1141 b/tests/data/test1141 new file mode 100644 index 000000000..9c41d3935 --- /dev/null +++ b/tests/data/test1141 @@ -0,0 +1,70 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP proxy +followlocation +</keywords> +</info> +# Server-side +<reply> +<data> +HTTP/1.1 302 This is a weirdo text message +Connection: close +Location: http:///foo.example.com/want/11410001 + +This server reply is for testing +</data> +<data1> +HTTP/1.1 200 hello +Connection: close +Content-Length: 4 + +hej +</data1> +<datacheck> +HTTP/1.1 302 This is a weirdo text message +Connection: close +Location: http:///foo.example.com/want/11410001 + +HTTP/1.1 200 hello +Connection: close +Content-Length: 4 + +hej +</datacheck> +</reply> + +# Client-side +<client> +<server> +http +</server> + <name> +HTTP redirect to http:/// (three slashes!) + </name> + <command> +%HOSTIP:%HTTPPORT/want/1141 -L -x http://%HOSTIP:%HTTPPORT +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET http://%HOSTIP:%HTTPPORT/want/1141 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+GET http://foo.example.com/want/11410001 HTTP/1.1
+Host: foo.example.com
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test1142 b/tests/data/test1142 new file mode 100644 index 000000000..76c6bdf55 --- /dev/null +++ b/tests/data/test1142 @@ -0,0 +1,64 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP proxy +followlocation +</keywords> +</info> +# Server-side +<reply> +<data> +HTTP/1.1 302 This is a weirdo text message +Connection: close +Location: http:////foo.example.com/want/11420001 + +This server reply is for testing +</data> +<data1> +HTTP/1.1 200 hello +Connection: close +Content-Length: 4 + +hej +</data1> +<datacheck> +HTTP/1.1 302 This is a weirdo text message +Connection: close +Location: http:////foo.example.com/want/11420001 + +</datacheck> +</reply> + +# Client-side +<client> +<server> +http +</server> + <name> +HTTP redirect to http://// (four slashes!) + </name> + <command> +%HOSTIP:%HTTPPORT/want/1142 -L -x http://%HOSTIP:%HTTPPORT +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET http://%HOSTIP:%HTTPPORT/want/1142 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol> +# 3, CURLE_URL_MALFORMAT for the four slashes +<errorcode> +3 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test1143 b/tests/data/test1143 new file mode 100644 index 000000000..4f2f4435a --- /dev/null +++ b/tests/data/test1143 @@ -0,0 +1,45 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +followlocation +</keywords> +</info> +# Server-side +<reply> +<data> +HTTP/1.1 200 hello +Connection: close +Content-Length: 4 + +hej +</data> +</reply> + +# Client-side +<client> +<server> +http +</server> + <name> +HTTP URL with http:/ (one slash!) + </name> + <command> +http:/%HOSTIP:%HTTPPORT/want/1143 +</command> +</client> + +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /want/1143 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test1144 b/tests/data/test1144 new file mode 100644 index 000000000..3b4a1b479 --- /dev/null +++ b/tests/data/test1144 @@ -0,0 +1,62 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP HEAD +</keywords> +</info> + +# +# Server-side +<reply> +<data> +No headers at all, just data swsclose + +Let's get + +a little + +so that + +we + +have + +some + +test + +data to + +verify +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +HTTP HEAD, receive no headers only body + </name> + <command> +-I http://%HOSTIP:%HTTPPORT/1144 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +HEAD /1144 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test1213 b/tests/data/test1213 index bc146b016..4f22f0d92 100644 --- a/tests/data/test1213 +++ b/tests/data/test1213 @@ -46,6 +46,7 @@ HTTP with proxy and host-only URL GET http://we.want.that.site.com.1213/ HTTP/1.1
Host: we.want.that.site.com.1213
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1214 b/tests/data/test1214 index e703f7a91..3eeb3e3ad 100644 --- a/tests/data/test1214 +++ b/tests/data/test1214 @@ -46,6 +46,7 @@ HTTP with proxy and URL with ? and no slash separator GET http://we.want.that.site.com.1214/?moo=foo HTTP/1.1
Host: we.want.that.site.com.1214
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1215 b/tests/data/test1215 index e22591c90..f8c52a9a1 100644 --- a/tests/data/test1215 +++ b/tests/data/test1215 @@ -92,12 +92,14 @@ Host: %HOSTIP:%HTTPPORT Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.30.0-DEV
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://%HOSTIP:%HTTPPORT/1215 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.30.0-DEV
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1216 b/tests/data/test1216 index 6e45ac6a3..5beda797d 100644 --- a/tests/data/test1216 +++ b/tests/data/test1216 @@ -50,11 +50,13 @@ example.fake TRUE /c FALSE 2139150993 moo3 indeed GET http://example.fake/c/1216 HTTP/1.1
Host: example.fake
Accept: */*
+Proxy-Connection: Keep-Alive
Cookie: moo2=indeed; moo3=indeed
GET http://bexample.fake/c/1216 HTTP/1.1
Host: bexample.fake
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1218 b/tests/data/test1218 index 9c2fc0389..e3f1f6d04 100644 --- a/tests/data/test1218 +++ b/tests/data/test1218 @@ -43,15 +43,18 @@ http://example.fake/c/1218 http://example.fake/c/1218 http://bexample.fake/c/121 GET http://example.fake/c/1218 HTTP/1.1
Host: example.fake
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://example.fake/c/1218 HTTP/1.1
Host: example.fake
Accept: */*
+Proxy-Connection: Keep-Alive
Cookie: bug=fixed
GET http://bexample.fake/c/1218 HTTP/1.1
Host: bexample.fake
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1228 b/tests/data/test1228 index d0af517de..a7e56a797 100644 --- a/tests/data/test1228 +++ b/tests/data/test1228 @@ -42,10 +42,12 @@ http://example.fake/hoge/1228 http://example.fake/hogege/ -b nonexisting -x %HOS GET http://example.fake/hoge/1228 HTTP/1.1
Host: example.fake
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://example.fake/hogege/ HTTP/1.1
Host: example.fake
Accept: */*
+Proxy-Connection: Keep-Alive
Cookie: path1=root
</protocol> diff --git a/tests/data/test1230 b/tests/data/test1230 index 8ce4c4ee6..3c1d3d448 100644 --- a/tests/data/test1230 +++ b/tests/data/test1230 @@ -69,6 +69,7 @@ http://[1234:1234:1234::4ce]:%HTTPPORT/wanted/page/1230 -p -x %HOSTIP:%HTTPPORT <protocol> CONNECT [1234:1234:1234::4ce]:%HTTPPORT HTTP/1.1
Host: [1234:1234:1234::4ce]:%HTTPPORT
+Proxy-Connection: Keep-Alive
GET /wanted/page/1230 HTTP/1.1
Host: [1234:1234:1234::4ce]:%HTTPPORT
diff --git a/tests/data/test1232 b/tests/data/test1232 index 1c5bc2031..ead43365f 100644 --- a/tests/data/test1232 +++ b/tests/data/test1232 @@ -53,10 +53,12 @@ HTTP URL with dotdot removal from path using an HTTP proxy GET http://test.remote.haxx.se.1232:8990/hej/but/1232?stupid=me/../1232 HTTP/1.1
Host: test.remote.haxx.se.1232:8990
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://test.remote.haxx.se.1232:8990/hej/but/12320001 HTTP/1.1
Host: test.remote.haxx.se.1232:8990
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1241 b/tests/data/test1241 index 5a127326d..aaa568868 100644 --- a/tests/data/test1241 +++ b/tests/data/test1241 @@ -52,10 +52,12 @@ HTTP _without_ dotdot removal GET http://test.remote.haxx.se.1241:8990/../../hej/but/who/../1241?stupid=me/../1241 HTTP/1.1
Host: test.remote.haxx.se.1241:8990
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://test.remote.haxx.se.1241:8990/../../hej/but/who/../12410001 HTTP/1.1
Host: test.remote.haxx.se.1241:8990
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1244 b/tests/data/test1244 new file mode 100644 index 000000000..d0769ad85 --- /dev/null +++ b/tests/data/test1244 @@ -0,0 +1,61 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP proxy +</keywords> +</info> +# +# Server-side +<reply> +<data> +HTTP/1.1 200 OK +Server: test-server/fake +Content-Length: 5 + +bing +</data> +<data1> +HTTP/1.1 200 OK +Server: test-server/fake +Content-Length: 6 + +wrong +</data1> +</reply> + +# +# Client-side +<client> +<server> +http +https +</server> + <name> +HTTP GET same URL - different proxy ports + </name> + <command> +http://%HOSTIP:%HTTPPORT/1244 -x %HOSTIP:%HTTPPORT --next http://%HOSTIP:%HTTPPORT/124400001 -x %HOSTIP:%HTTPSPORT +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +# the second request meant to fail +<errorcode> +56 +</errorcode> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET http://%HOSTIP:%HTTPPORT/1244 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test1312 b/tests/data/test1312 index 92144015a..bed492c16 100644 --- a/tests/data/test1312 +++ b/tests/data/test1312 @@ -40,7 +40,7 @@ HTTP GET with -J, Content-Disposition and ; in filename CURL_TESTDIR=%PWD/log </setenv> <command option="no-output,no-include"> -http://%HOSTIP:%HTTPPORT/1312 -J -O +%HOSTIP:%HTTPPORT/1312 -J -O </command> </client> diff --git a/tests/data/test1314 b/tests/data/test1314 index 11e128a85..078ada64a 100644 --- a/tests/data/test1314 +++ b/tests/data/test1314 @@ -67,10 +67,12 @@ http://firstplace.example.com/want/1314 -L -x http://%HOSTIP:%HTTPPORT GET http://firstplace.example.com/want/1314 HTTP/1.1
Host: firstplace.example.com
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://somewhere.example.com/reply/1314 HTTP/1.1
Host: somewhere.example.com
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test1319 b/tests/data/test1319 index a97da9c41..0520b1b32 100644 --- a/tests/data/test1319 +++ b/tests/data/test1319 @@ -79,6 +79,7 @@ QUIT CONNECT pop.1319:%POP3PORT HTTP/1.1
Host: pop.1319:%POP3PORT
User-Agent: curl/7.24.0-DEV (i686-pc-linux-gnu) libcurl/7.24.0-DEV OpenSSL/1.0.0e zlib/1.2.3.4 c-ares/1.7.6-DEV libidn/1.23 libssh2/1.4.0_DEV librtmp/2.2e
+Proxy-Connection: Keep-Alive
</proxy> </verify> diff --git a/tests/data/test1320 b/tests/data/test1320 index 609f4c2f7..7a15f8091 100644 --- a/tests/data/test1320 +++ b/tests/data/test1320 @@ -66,6 +66,7 @@ body CONNECT smtp.1320:%SMTPPORT HTTP/1.1
Host: smtp.1320:%SMTPPORT
User-Agent: curl/7.24.0-DEV (i686-pc-linux-gnu) libcurl/7.24.0-DEV OpenSSL/1.0.0e zlib/1.2.3.4 c-ares/1.7.6-DEV libidn/1.23 libssh2/1.4.0_DEV librtmp/2.2e
+Proxy-Connection: Keep-Alive
</proxy> </verify> diff --git a/tests/data/test1321 b/tests/data/test1321 index b5ad277b0..266fd8828 100644 --- a/tests/data/test1321 +++ b/tests/data/test1321 @@ -75,6 +75,7 @@ A005 LOGOUT CONNECT imap.1321:%IMAPPORT HTTP/1.1
Host: imap.1321:%IMAPPORT
User-Agent: curl/7.24.0-DEV (i686-pc-linux-gnu) libcurl/7.24.0-DEV OpenSSL/1.0.0e zlib/1.2.3.4 c-ares/1.7.6-DEV libidn/1.23 libssh2/1.4.0_DEV librtmp/2.2e
+Proxy-Connection: Keep-Alive
</proxy> </verify> diff --git a/tests/data/test1322 b/tests/data/test1322 new file mode 100644 index 000000000..bf10a8d0b --- /dev/null +++ b/tests/data/test1322 @@ -0,0 +1,57 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +--resolve +trailing dot +</keywords> +</info> + +# +# Server-side +<reply> +<data> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT +ETag: "21025-dc7-39462498" +Accept-Ranges: bytes +Content-Length: 6 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +-foo- +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> +<name> +HTTP with --resolve and hostname with trailing dot +</name> +<command> +--resolve example.com:%HTTPPORT:%HOSTIP http://example.com.:%HTTPPORT/1322 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /1322 HTTP/1.1
+Host: example.com:%HTTPPORT
+Accept: */*
+
+</protocol> +</verify> +</testcase> diff --git a/tests/data/test1331 b/tests/data/test1331 index 837ef8dd7..3299df469 100644 --- a/tests/data/test1331 +++ b/tests/data/test1331 @@ -75,11 +75,13 @@ HTTP --proxy-anyauth and 407 with cookies GET http://z.x.com/1331 HTTP/1.1
Host: z.x.com
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://z.x.com/1331 HTTP/1.1
Host: z.x.com
Proxy-Authorization: Basic bXluYW1lOm15cGFzc3dvcmQ=
Accept: */*
+Proxy-Connection: Keep-Alive
Cookie: proxycookie=weirdo
</protocol> diff --git a/tests/data/test1415 b/tests/data/test1415 index 37cfb073b..560440407 100644 --- a/tests/data/test1415 +++ b/tests/data/test1415 @@ -57,6 +57,7 @@ http://example.com/we/want/1415 -b none -c log/jar1415.txt -x %HOSTIP:%HTTPPORT GET http://example.com/we/want/1415 HTTP/1.1
Host: example.com
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> diff --git a/tests/data/test1421 b/tests/data/test1421 index 889c938db..6c59b2160 100644 --- a/tests/data/test1421 +++ b/tests/data/test1421 @@ -59,10 +59,12 @@ Content-Length: 6 GET http://test.remote.haxx.se.1421:8990/ HTTP/1.1
Host: test.remote.haxx.se.1421:8990
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://different.remote.haxx.se.1421:8990/ HTTP/1.1
Host: different.remote.haxx.se.1421:8990
Accept: */*
+Proxy-Connection: Keep-Alive
[DISCONNECT] </protocol> diff --git a/tests/data/test1428 b/tests/data/test1428 index 60fb8a93e..59041ec96 100644 --- a/tests/data/test1428 +++ b/tests/data/test1428 @@ -64,6 +64,7 @@ http://test.1428:%HTTPPORT/we/want/that/page/1428 -p -x %HOSTIP:%PROXYPORT --use CONNECT test.1428:%HTTPPORT HTTP/1.1
Host: test.1428:%HTTPPORT
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
+Proxy-Connection: Keep-Alive
header-type: proxy
</proxy> diff --git a/tests/data/test148 b/tests/data/test148 index fbac10f9c..540c8fe33 100644 --- a/tests/data/test148 +++ b/tests/data/test148 @@ -42,6 +42,7 @@ PASS ftp@example.com PWD
CWD attempt
MKD attempt
+CWD attempt
QUIT
</protocol> </verify> diff --git a/tests/data/test1509 b/tests/data/test1509 index 18eb07f1e..b4bfc6603 100644 --- a/tests/data/test1509 +++ b/tests/data/test1509 @@ -74,6 +74,7 @@ moo <proxy> CONNECT the.old.moo.1509:%HTTPPORT HTTP/1.1
Host: the.old.moo.1509:%HTTPPORT
+Proxy-Connection: Keep-Alive
</proxy> <protocol> diff --git a/tests/data/test1517 b/tests/data/test1517 new file mode 100644 index 000000000..d0a4aeca3 --- /dev/null +++ b/tests/data/test1517 @@ -0,0 +1,69 @@ +<testcase> +<info> +<keywords> +HTTP +POST +POST callback +slow callback +early response +</keywords> +</info> +# +# This reproduces issue #657, fixed with PR #668 - on Windows +# +# Server-side +<reply> +# Force server reply right after request headers, not waiting for request body +<servercmd> +skip: 45 +</servercmd> +<data> +HTTP/1.1 500 Internal Server Error +Date: Thu, 17 Mar 2016 14:41:00 GMT +Server: test-server/fake +Content-Type: text/plain; charset=US-ASCII +X-Special: swsclose +Content-Length: 55 +Connection: close + +This is a virtual description of server virtual error. +</data> +</reply> + +# Client-side +<client> +<server> +http +</server> +# tool is what to use instead of 'curl' +<tool> +lib1517 +</tool> + + <name> +HTTP POST, server responds before completed send + </name> + <command> +http://%HOSTIP:%HTTPPORT/1517 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strippart> +s/^(this is what we post to the silly web server)(\r)?\n// +</strippart> +<protocol> +POST /1517 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+Content-Length: 45
+Content-Type: application/x-www-form-urlencoded
+
+</protocol> +<errorcode> +0 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test1525 b/tests/data/test1525 index d8f68838d..0560d5c1a 100644 --- a/tests/data/test1525 +++ b/tests/data/test1525 @@ -58,6 +58,7 @@ CURLOPT_PROXYHEADER is ignored CURLHEADER_UNIFIED <proxy> CONNECT the.old.moo.1525:%HTTPPORT HTTP/1.1
Host: the.old.moo.1525:%HTTPPORT
+Proxy-Connection: Keep-Alive
User-Agent: Http Agent
</proxy> diff --git a/tests/data/test1526 b/tests/data/test1526 index 9f5d09e6d..aa111c890 100644 --- a/tests/data/test1526 +++ b/tests/data/test1526 @@ -58,6 +58,7 @@ CURLOPT_PROXYHEADER: separate host/proxy headers <proxy> CONNECT the.old.moo.1526:%HTTPPORT HTTP/1.1
Host: the.old.moo.1526:%HTTPPORT
+Proxy-Connection: Keep-Alive
User-Agent: Proxy Agent
</proxy> diff --git a/tests/data/test1527 b/tests/data/test1527 index 69ae6e4a0..e8d52794b 100644 --- a/tests/data/test1527 +++ b/tests/data/test1527 @@ -57,6 +57,7 @@ Check same headers are generated with CURLOPT_HEADEROPT == CURLHEADER_UNIFIED <proxy> CONNECT the.old.moo.1527:%HTTPPORT HTTP/1.1
Host: the.old.moo.1527:%HTTPPORT
+Proxy-Connection: Keep-Alive
User-Agent: Http Agent
Expect: 100-continue
diff --git a/tests/data/test1528 b/tests/data/test1528 index e60f60026..876806af4 100644 --- a/tests/data/test1528 +++ b/tests/data/test1528 @@ -51,6 +51,7 @@ Separately specified proxy/server headers sent in a proxy GET GET http://the.old.moo:%HTTPPORT/1528 HTTP/1.1
Host: the.old.moo:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
User-Agent: Http Agent
Proxy-User-Agent: Http Agent2
diff --git a/tests/data/test16 b/tests/data/test16 index 9d9a9cc1c..15f4c7a7b 100644 --- a/tests/data/test16 +++ b/tests/data/test16 @@ -45,6 +45,7 @@ GET http://we.want.that.site.com/16 HTTP/1.1 Host: we.want.that.site.com
Proxy-Authorization: Basic ZmFrZUB1c2VyOmxvb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29uZw==
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test161 b/tests/data/test161 index 045835998..91a3388fc 100644 --- a/tests/data/test161 +++ b/tests/data/test161 @@ -32,8 +32,8 @@ ftp://%HOSTIP:%FTPPORT/161 # Verify data after the test has been "shot" <verify> -# This gets QUIT sent because CURLE_PARTIAL_FILE does NOT mark the control -# connection as bad +# This doesn't send QUIT because of known bug: +# "7.8 Premature transfer end but healthy control channel" <protocol> USER anonymous
PASS ftp@example.com
@@ -42,8 +42,8 @@ EPSV TYPE I
SIZE 161
RETR 161
-QUIT
</protocol> +# CURLE_PARTIAL_FILE = 18 <errorcode> 18 </errorcode> diff --git a/tests/data/test162 b/tests/data/test162 index cc4c82d45..ee2f40aa7 100644 --- a/tests/data/test162 +++ b/tests/data/test162 @@ -51,6 +51,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.8.1-pre3 (sparc-sun-solaris2.7) libcurl 7.8.1-pre3 (OpenSSL 0.9.6a) (krb4 enabled)
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <errorcode> diff --git a/tests/data/test165 b/tests/data/test165 index b475fdef1..ddfe1e9dc 100644 --- a/tests/data/test165 +++ b/tests/data/test165 @@ -51,6 +51,7 @@ http://www.åäö.se/page/165 -x %HOSTIP:%HTTPPORT GET http://www.xn--4cab6c.se/page/165 HTTP/1.1
Host: www.xn--4cab6c.se
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test167 b/tests/data/test167 index 76f9e5c7f..0b14996a3 100644 --- a/tests/data/test167 +++ b/tests/data/test167 @@ -65,6 +65,7 @@ Host: data.from.server.requiring.digest.hohoho.com Proxy-Authorization: Basic Zm9vOmJhcg==
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b zlib/1.1.4 c-ares/1.2.0 libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://data.from.server.requiring.digest.hohoho.com/167 HTTP/1.1
Host: data.from.server.requiring.digest.hohoho.com
@@ -72,6 +73,7 @@ Proxy-Authorization: Basic Zm9vOmJhcg== Authorization: Digest username="digest", realm="weirdorealm", nonce="12345", uri="/167", response="13c7c02a252cbe1c46d8669898a3be26"
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b zlib/1.1.4 c-ares/1.2.0 libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test168 b/tests/data/test168 index 0f4e02573..20e0b6d9c 100644 --- a/tests/data/test168 +++ b/tests/data/test168 @@ -78,12 +78,14 @@ GET http://data.from.server.requiring.digest.hohoho.com/168 HTTP/1.1 Host: data.from.server.requiring.digest.hohoho.com
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b zlib/1.1.4 c-ares/1.2.0 libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://data.from.server.requiring.digest.hohoho.com/168 HTTP/1.1
Host: data.from.server.requiring.digest.hohoho.com
Proxy-Authorization: Digest username="foo", realm="weirdorealm", nonce="12345", uri="/168", response="fb8608e00ad9239a3dedb14bc8575976"
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b zlib/1.1.4 c-ares/1.2.0 libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://data.from.server.requiring.digest.hohoho.com/168 HTTP/1.1
Host: data.from.server.requiring.digest.hohoho.com
@@ -91,6 +93,7 @@ Proxy-Authorization: Digest username="foo", realm="weirdorealm", nonce="12345", Authorization: Digest username="digest", realm="realmweirdo", nonce="123456", uri="/168", response="ca87f2d768a231e2d637a55698d5c416"
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test169 b/tests/data/test169 index be5b4c6d9..73ca9bd20 100644 --- a/tests/data/test169 +++ b/tests/data/test169 @@ -108,18 +108,21 @@ Host: data.from.server.requiring.digest.hohoho.com Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://data.from.server.requiring.digest.hohoho.com/169 HTTP/1.1
Host: data.from.server.requiring.digest.hohoho.com
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://data.from.server.requiring.digest.hohoho.com/169 HTTP/1.1
Host: data.from.server.requiring.digest.hohoho.com
Authorization: Digest username="digest", realm="r e a l m", nonce="abcdef", uri="/169", response="95d48591985a03c4b49cb962aa7bd3e6"
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 GSS libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test170 b/tests/data/test170 index 48a263f46..8ce7774f9 100644 --- a/tests/data/test170 +++ b/tests/data/test170 @@ -40,6 +40,7 @@ Host: a.galaxy.far.far.away Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.12.0-CVS (i686-pc-linux-gnu) libcurl/7.12.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4 libidn/0.4.3
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
</protocol> diff --git a/tests/data/test1700 b/tests/data/test1700 new file mode 100644 index 000000000..9ab46c9cd --- /dev/null +++ b/tests/data/test1700 @@ -0,0 +1,101 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP/2 +</keywords> +</info> + +# +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT +ETag: "21025-dc7-39462498" +Accept-Ranges: bytes +Content-Length: 6 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +-foo- +</data> +<data1> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 6 +Connection: close +Content-Type: text/html + +-maa- +</data1> +</reply> + +# +# Client-side +<client> +<server> +http +http/2 +</server> + <name> +HTTP/2 GET with Upgrade: + </name> + <command> +http://%HOSTIP:%HTTP2PORT/1700 --http2 http://%HOSTIP:%HTTP2PORT/17000001 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +^X-Forwarded-Proto:.* +^Via:.* +</strip> +<protocol> +GET /1700 HTTP/1.1
+Host: %HOSTIP:%HTTP2PORT
+Accept: */*
+
+GET /17000001 HTTP/1.1
+Host: %HOSTIP:%HTTP2PORT
+Accept: */*
+
+</protocol> +<stdout> +HTTP/1.1 101 Switching Protocols
+Connection: Upgrade
+Upgrade: h2c
+
+HTTP/2 200
+date: Thu, 09 Nov 2010 14:49:00 GMT
+last-modified: Tue, 13 Jun 2000 12:10:00 GMT
+etag: "21025-dc7-39462498"
+accept-ranges: bytes
+content-length: 6
+content-type: text/html
+funny-head: yesyes
+server: cut-out
+via: 1.1 nghttpx
+
+-foo- +HTTP/2 200
+date: Thu, 09 Nov 2010 14:49:00 GMT
+content-length: 6
+content-type: text/html
+server: cut-out
+via: 1.1 nghttpx
+
+-maa- +</stdout> +<stripfile> +s/^server:.*/server: cut-out
/ +</stripfile> +</verify> +</testcase> diff --git a/tests/data/test1701 b/tests/data/test1701 new file mode 100644 index 000000000..494328877 --- /dev/null +++ b/tests/data/test1701 @@ -0,0 +1,83 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP POST +HTTP/2 +</keywords> +</info> + +# +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT +ETag: "21025-dc7-39462498" +Accept-Ranges: bytes +Content-Length: 6 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +-foo- +</data> +</reply> + +# +# Client-side +<client> +<server> +http +http/2 +</server> + <name> +HTTP/2 POST with Upgrade: + </name> + <command> +http://%HOSTIP:%HTTP2PORT/1701 --http2 -d "datatosend" +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +^X-Forwarded-Proto:.* +^Via:.* +</strip> +<protocol nonewline="yes"> +POST /1701 HTTP/1.1
+Host: %HOSTIP:%HTTP2PORT
+Accept: */*
+Content-Length: 10
+Content-Type: application/x-www-form-urlencoded
+
+datatosend +</protocol> +<stdout> +HTTP/1.1 101 Switching Protocols
+Connection: Upgrade
+Upgrade: h2c
+
+HTTP/2 200
+date: Thu, 09 Nov 2010 14:49:00 GMT
+last-modified: Tue, 13 Jun 2000 12:10:00 GMT
+etag: "21025-dc7-39462498"
+accept-ranges: bytes
+content-length: 6
+content-type: text/html
+funny-head: yesyes
+server: cut-out
+via: 1.1 nghttpx
+
+-foo- +</stdout> +<stripfile> +s/^server:.*/server: cut-out
/ +</stripfile> +</verify> +</testcase> diff --git a/tests/data/test1702 b/tests/data/test1702 new file mode 100644 index 000000000..903a737c9 --- /dev/null +++ b/tests/data/test1702 @@ -0,0 +1,78 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP HEAD +HTTP/2 +</keywords> +</info> + +# +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+</data> +</reply> + +# +# Client-side +<client> +<server> +http +http/2 +</server> + <name> +HTTP/2 HEAD with Upgrade: + </name> + <command> +http://%HOSTIP:%HTTP2PORT/1702 --http2 --head +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +^X-Forwarded-Proto:.* +^Via:.* +</strip> +<protocol> +HEAD /1702 HTTP/1.1
+Host: %HOSTIP:%HTTP2PORT
+Accept: */*
+
+</protocol> +<stdout> +HTTP/1.1 101 Switching Protocols
+Connection: Upgrade
+Upgrade: h2c
+
+HTTP/2 200
+date: Thu, 09 Nov 2010 14:49:00 GMT
+last-modified: Tue, 13 Jun 2000 12:10:00 GMT
+etag: "21025-dc7-39462498"
+accept-ranges: bytes
+content-length: 6
+content-type: text/html
+funny-head: yesyes
+server: cut-out
+via: 1.1 nghttpx
+
+</stdout> +<stripfile> +s/^server:.*/server: cut-out
/ +</stripfile> +</verify> +</testcase> diff --git a/tests/data/test171 b/tests/data/test171 index 3b9f7ba8c..09e48b70a 100644 --- a/tests/data/test171 +++ b/tests/data/test171 @@ -44,6 +44,7 @@ HTTP, get cookie with dot prefixed full domain GET http://z.x.com/171 HTTP/1.1
Host: z.x.com
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <file name="log/jar171" mode="text"> diff --git a/tests/data/test179 b/tests/data/test179 index 1cd5badf1..f8f7811a7 100644 --- a/tests/data/test179 +++ b/tests/data/test179 @@ -49,6 +49,7 @@ supertrooper.fake FALSE /c FALSE 2139150993 moo2 indeed GET http://supertrooper.fake/c/179 HTTP/1.1
Host: supertrooper.fake
Accept: */*
+Proxy-Connection: Keep-Alive
Cookie: moo2=indeed
</protocol> diff --git a/tests/data/test1800 b/tests/data/test1800 index b7d534edd..96a6c1461 100644 --- a/tests/data/test1800 +++ b/tests/data/test1800 @@ -2,7 +2,7 @@ <info> <keywords> HTTP -http2 +HTTP/2 </keywords> </info> @@ -27,7 +27,7 @@ Content-Type: text/html http </server> <features> -http2 +http/2 </features> <name> HTTP/2 upgrade refused diff --git a/tests/data/test1801 b/tests/data/test1801 index 0aedfed51..16ee12d42 100644 --- a/tests/data/test1801 +++ b/tests/data/test1801 @@ -2,7 +2,7 @@ <info> <keywords> HTTP -http2 +HTTP/2 </keywords> </info> @@ -37,7 +37,7 @@ upgrade http </server> <features> -http2 +http/2 </features> <name> HTTP/2 upgrade with lying server diff --git a/tests/data/test183 b/tests/data/test183 index b44710998..f34dc0c98 100644 --- a/tests/data/test183 +++ b/tests/data/test183 @@ -42,11 +42,13 @@ GET http://deathstar.another.galaxy/183 HTTP/1.1 User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.6b zlib/1.1.4 libidn/0.4.6
Host: deathstar.another.galaxy
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://a.galaxy.far.far.away/183 HTTP/1.1
User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.6b zlib/1.1.4 libidn/0.4.6 Host: a.galaxy.far.far.away
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> diff --git a/tests/data/test184 b/tests/data/test184 index 9cadc8290..8b09dde28 100644 --- a/tests/data/test184 +++ b/tests/data/test184 @@ -62,10 +62,12 @@ GET http://deathstar.another.galaxy/184 HTTP/1.1 Host: another.visitor.stay.a.while.stay.foreeeeeever
User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.6b zlib/1.1.4 libidn/0.4.6
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://yet.another.host/184 HTTP/1.1
Host: yet.another.host
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> diff --git a/tests/data/test185 b/tests/data/test185 index dbef6e7ea..298dd49ce 100644 --- a/tests/data/test185 +++ b/tests/data/test185 @@ -62,10 +62,12 @@ GET http://deathstar.another.galaxy/185 HTTP/1.1 Host: another.visitor.stay.a.while.stay.foreeeeeever
User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.6b zlib/1.1.4 libidn/0.4.6
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://deathstar.another.galaxy/go/west/185 HTTP/1.1
Host: another.visitor.stay.a.while.stay.foreeeeeever
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> diff --git a/tests/data/test2047 b/tests/data/test2047 index a8cca2f40..442297801 100644 --- a/tests/data/test2047 +++ b/tests/data/test2047 @@ -63,10 +63,12 @@ http://åäö.se/2047 -x %HOSTIP:%HTTPPORT -w "%{num_connects}\n%{num_redirects} GET http://xn--4cab6c.se/2047 HTTP/1.1
Host: xn--4cab6c.se
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://xn--4cab6c.se/20470001 HTTP/1.1
Host: xn--4cab6c.se
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> diff --git a/tests/data/test2049 b/tests/data/test2049 new file mode 100644 index 000000000..efa576e98 --- /dev/null +++ b/tests/data/test2049 @@ -0,0 +1,64 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +CURLOPT_CONNECT_TO +</keywords> +</info> + +# +# Server-side +<reply> +<data> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +Connect to specific host + </name> + + <command> +http://www1.example.com:8081/2049 --connect-to ::%HOSTIP:%HTTPPORT --next http://www2.example.com:8082/2049 --connect-to :8082:%HOSTIP:%HTTPPORT --next http://www3.example.com:8083/2049 --connect-to www3.example.com::%HOSTIP:%HTTPPORT --next http://www4.example.com:8084/2049 --connect-to www4.example.com:8084:%HOSTIP:%HTTPPORT +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /2049 HTTP/1.1
+Host: www1.example.com:8081
+Accept: */*
+
+GET /2049 HTTP/1.1
+Host: www2.example.com:8082
+Accept: */*
+
+GET /2049 HTTP/1.1
+Host: www3.example.com:8083
+Accept: */*
+
+GET /2049 HTTP/1.1
+Host: www4.example.com:8084
+Accept: */*
+
+</protocol> + +</verify> +</testcase> diff --git a/tests/data/test2050 b/tests/data/test2050 new file mode 100644 index 000000000..81ef79ffc --- /dev/null +++ b/tests/data/test2050 @@ -0,0 +1,78 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +HTTP CONNECT +HTTP proxy +proxytunnel +CURLOPT_CONNECT_TO +</keywords> +</info> + +# +# Server-side +<reply> +<connect> +HTTP/1.1 200 Connection established + +</connect> + +<data> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +</data> + +<datacheck> +HTTP/1.1 200 Connection established + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +</datacheck> +</reply> + +# +# Client-side +<client> +<server> +http +http-proxy +</server> + <name> +Connect to specific host via HTTP proxy (switch to tunnel mode automatically) + </name> + + <command> +http://www.example.com.2050/2050 --connect-to ::connect.example.com.2050:%HTTPPORT -x %HOSTIP:%PROXYPORT +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<proxy> +CONNECT connect.example.com.2050:%HTTPPORT HTTP/1.1
+Host: connect.example.com.2050:%HTTPPORT
+Proxy-Connection: Keep-Alive
+
+</proxy> +<protocol> +GET /2050 HTTP/1.1
+Host: www.example.com.2050
+Accept: */*
+
+</protocol> + +</verify> +</testcase> diff --git a/tests/data/test2051 b/tests/data/test2051 new file mode 100644 index 000000000..e8c6bed1d --- /dev/null +++ b/tests/data/test2051 @@ -0,0 +1,74 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +CURLOPT_CONNECT_TO +</keywords> +</info> + +# +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +Connect to specific host: Re-use existing connections if possible + </name> + + <command> +http://%HOSTIP:%HTTPPORT/2051 -w "%{num_connects}\n" --next --connect-to ::%HOSTIP:%HTTPPORT http://%HOSTIP:%HTTPPORT/2051 -w "%{num_connects}\n" --next http://%HOSTIP:%HTTPPORT/2051 -w "%{num_connects}\n" +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /2051 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+GET /2051 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+GET /2051 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> + +<stdout> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +1 +OK +0 +OK +0 +</stdout> + +</verify> +</testcase> diff --git a/tests/data/test2052 b/tests/data/test2052 new file mode 100644 index 000000000..082002f2c --- /dev/null +++ b/tests/data/test2052 @@ -0,0 +1,68 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +CURLOPT_CONNECT_TO +</keywords> +</info> + +# +# Server-side +<reply> +<data nocheck="yes"> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> + <name> +Connect to specific host: Do not mix connections with and without a "connect to host" + </name> + + <command> +http://www.example.com:%HTTPPORT/2052 --resolve www.example.com:%HTTPPORT:%HOSTIP -w "%{num_connects}\n" --next --resolve -www.example.com:%HTTPPORT --connect-to ::%HOSTIP:%HTTPPORT http://www.example.com:%HTTPPORT/2052 -w "%{num_connects}\n" +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<strip> +^User-Agent:.* +</strip> +<protocol> +GET /2052 HTTP/1.1
+Host: www.example.com:%HTTPPORT
+Accept: */*
+
+GET /2052 HTTP/1.1
+Host: www.example.com:%HTTPPORT
+Accept: */*
+
+</protocol> + +<stdout> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 3 +Content-Type: text/plain + +OK +1 +OK +1 +</stdout> + +</verify> +</testcase> diff --git a/tests/data/test206 b/tests/data/test206 index efbc56e0c..5f0c88562 100644 --- a/tests/data/test206 +++ b/tests/data/test206 @@ -90,10 +90,12 @@ http://test.remote.haxx.se.206:8990/path/2060002 --proxy http://%HOSTIP:%HTTPPOR <protocol> CONNECT test.remote.haxx.se.206:8990 HTTP/1.1
Host: test.remote.haxx.se.206:8990
+Proxy-Connection: Keep-Alive
CONNECT test.remote.haxx.se.206:8990 HTTP/1.1
Host: test.remote.haxx.se.206:8990
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="test.remote.haxx.se.206:8990", response="003e36decb4dbf6366b3ecb9b87c24ec"
+Proxy-Connection: Keep-Alive
GET /path/2060002 HTTP/1.1
User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4
diff --git a/tests/data/test208 b/tests/data/test208 index fb4c0ea13..afb2566b5 100644 --- a/tests/data/test208 +++ b/tests/data/test208 @@ -57,6 +57,7 @@ PUT ftp://daniel:mysecret@host.com/we/want/208 HTTP/1.1 Host: host.com:21
Authorization: Basic ZGFuaWVsOm15c2VjcmV0
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 78
Expect: 100-continue
diff --git a/tests/data/test209 b/tests/data/test209 index f868541c6..961eba1a2 100644 --- a/tests/data/test209 +++ b/tests/data/test209 @@ -104,10 +104,12 @@ chkhostname curlhost CONNECT test.remote.example.com.209:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.209:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
+Proxy-Connection: Keep-Alive
CONNECT test.remote.example.com.209:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.209:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
+Proxy-Connection: Keep-Alive
GET /path/2090002 HTTP/1.1
User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4
diff --git a/tests/data/test213 b/tests/data/test213 index 7ceed9849..edbb6a6f3 100644 --- a/tests/data/test213 +++ b/tests/data/test213 @@ -104,10 +104,12 @@ chkhostname curlhost CONNECT test.remote.example.com.213:%HTTPPORT HTTP/1.0
Host: test.remote.example.com.213:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
+Proxy-Connection: Keep-Alive
CONNECT test.remote.example.com.213:%HTTPPORT HTTP/1.0
Host: test.remote.example.com.213:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
+Proxy-Connection: Keep-Alive
POST /path/2130002 HTTP/1.1
User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4
diff --git a/tests/data/test217 b/tests/data/test217 index 0e0c0add1..f10df566b 100644 --- a/tests/data/test217 +++ b/tests/data/test217 @@ -44,6 +44,7 @@ http://test.remote.example.com.217:%HTTPPORT/path/2170002 --proxy http://%HOSTIP <protocol> CONNECT test.remote.example.com.217:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.217:%HTTPPORT
+Proxy-Connection: Keep-Alive
</protocol> # CURLE_RECV_ERROR diff --git a/tests/data/test219 b/tests/data/test219 new file mode 100644 index 000000000..be3f0f3c5 --- /dev/null +++ b/tests/data/test219 @@ -0,0 +1,37 @@ +<testcase> +<info> +<keywords> +proxy +</keywords> +</info> + +# +# Server-side +<reply> +</reply> + +# +# Client-side +<client> +<server> +none +</server> +<features> +http +</features> + <name> +try using proxy with unsupported scheme + </name> + <command> +-x foo://%HOSTIP:%HTTPPORT/219 http://%HOSTIP:%HTTPPORT/219 +</command> +</client> + +# +# Verify after the test has been "shot" +<verify> +<errorcode> +7 +</errorcode> +</verify> +</testcase> diff --git a/tests/data/test233 b/tests/data/test233 index 996855d59..b631e52cf 100644 --- a/tests/data/test233 +++ b/tests/data/test233 @@ -81,11 +81,13 @@ Host: first.host.it.is Proxy-Authorization: Basic dGVzdGluZzp0aGlz
Authorization: Basic aWFtOm15c2VsZg==
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://goto.second.host.now/2330002 HTTP/1.1
Host: goto.second.host.now
Proxy-Authorization: Basic dGVzdGluZzp0aGlz
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test234 b/tests/data/test234 index f7da2b95e..1d2e05b39 100644 --- a/tests/data/test234 +++ b/tests/data/test234 @@ -83,12 +83,14 @@ Host: first.host.it.is Proxy-Authorization: Basic dGVzdGluZzp0aGlz
Authorization: Basic aWFtOm15c2VsZg==
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://goto.second.host.now/2340002 HTTP/1.1
Host: goto.second.host.now
Proxy-Authorization: Basic dGVzdGluZzp0aGlz
Authorization: Basic aWFtOm15c2VsZg==
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test239 b/tests/data/test239 index 275c81b3c..6b92f07f7 100644 --- a/tests/data/test239 +++ b/tests/data/test239 @@ -83,6 +83,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
@@ -91,6 +92,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 6
Content-Type: application/x-www-form-urlencoded
diff --git a/tests/data/test243 b/tests/data/test243 index bc09286ee..3496055d1 100644 --- a/tests/data/test243 +++ b/tests/data/test243 @@ -103,6 +103,7 @@ POST http://%HOSTIP:%HTTPPORT/243 HTTP/1.1 Host: %HOSTIP:%HTTPPORT
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 6
Content-Type: application/x-www-form-urlencoded
@@ -111,6 +112,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
@@ -119,6 +121,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 6
Content-Type: application/x-www-form-urlencoded
diff --git a/tests/data/test256 b/tests/data/test256 index 0acd9db12..2b96ecf3d 100644 --- a/tests/data/test256 +++ b/tests/data/test256 @@ -51,6 +51,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: Basic ZGFuaWVsOnN0ZW5iZXJn
Range: bytes=78-
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> diff --git a/tests/data/test257 b/tests/data/test257 index 45dcbd556..502448ddb 100644 --- a/tests/data/test257 +++ b/tests/data/test257 @@ -92,17 +92,20 @@ Host: supersite.com Authorization: Basic dXNlcjE6cGFzc3dkMQ==
User-Agent: curl/7.14.0-CVS (i686-pc-linux-gnu) libcurl/7.14.0-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://anotherone.com/2570002 HTTP/1.1
Host: anotherone.com
Authorization: Basic dXNlcjI6cGFzc3dkMg==
User-Agent: curl/7.14.0-CVS (i686-pc-linux-gnu) libcurl/7.14.0-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13 Accept: */*
+Proxy-Connection: Keep-Alive
GET http://athird.com/2570003 HTTP/1.1
Host: athird.com
User-Agent: curl/7.14.0-CVS (i686-pc-linux-gnu) libcurl/7.14.0-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13 Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test258 b/tests/data/test258 index 82c6731cc..98c340141 100644 --- a/tests/data/test258 +++ b/tests/data/test258 @@ -20,6 +20,7 @@ HTTP/1.1 407 no, tell me who you are first swsclose Date: Thu, 09 Nov 2010 14:49:00 GMT Server: test-server/fake Proxy-Authenticate: Digest realm="many secrets", nonce="911" +Proxy-Connection: close Content-Length: 0 </data> @@ -36,6 +37,7 @@ HTTP/1.1 407 no, tell me who you are first swsclose Date: Thu, 09 Nov 2010 14:49:00 GMT Server: test-server/fake Proxy-Authenticate: Digest realm="many secrets", nonce="911" +Proxy-Connection: close Content-Length: 0 HTTP/1.1 200 A OK
@@ -81,6 +83,7 @@ POST http://remotehost:54321/we/want/258 HTTP/1.1 Host: remotehost:54321
User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 409
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce
@@ -106,6 +109,7 @@ Host: remotehost:54321 User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Proxy-Authorization: Digest username="uuuser", realm="many secrets", nonce="911", uri="/we/want/258", response="2501654ca391f0b5c8c12a1da77e34cd"
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 409
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce
diff --git a/tests/data/test259 b/tests/data/test259 index 75b1f531c..9532887a9 100644 --- a/tests/data/test259 +++ b/tests/data/test259 @@ -79,6 +79,7 @@ POST http://remotehost:54321/we/want/259 HTTP/1.1 Host: remotehost:54321
User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 409
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce
@@ -105,6 +106,7 @@ Host: remotehost:54321 User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Proxy-Authorization: Digest username="uuuser", realm="many secrets", nonce="911", uri="/we/want/259", response="b479994d13e60f3aa192a67c5892ddc5"
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 409
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------7c633d5c27ce
diff --git a/tests/data/test263 b/tests/data/test263 index df0ba032f..5088141f5 100644 --- a/tests/data/test263 +++ b/tests/data/test263 @@ -47,6 +47,7 @@ HTTP-IPv6 GET with proxy specified using IPv6-numerical address GET http://veryveryremotesite.com/263 HTTP/1.1
Host: veryveryremotesite.com
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test264 b/tests/data/test264 index 1174ca54d..f4d171a16 100644 --- a/tests/data/test264 +++ b/tests/data/test264 @@ -42,6 +42,7 @@ GET http://we.want.that.site.com/264 HTTP/1.1 Host: we.want.that.site.com
Proxy-Authorization: Basic ZmFrZTp1c2Vy
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test265 b/tests/data/test265 index 79ab183f0..1a162b808 100644 --- a/tests/data/test265 +++ b/tests/data/test265 @@ -107,10 +107,12 @@ chkhostname curlhost CONNECT test.remote.example.com.265:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.265:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
+Proxy-Connection: Keep-Alive
CONNECT test.remote.example.com.265:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.265:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
+Proxy-Connection: Keep-Alive
POST /path/2650002 HTTP/1.1
User-Agent: curl/7.12.3-CVS (i686-pc-linux-gnu) libcurl/7.12.3-CVS OpenSSL/0.9.6b zlib/1.1.4
diff --git a/tests/data/test275 b/tests/data/test275 index 600045482..802c4bbcc 100644 --- a/tests/data/test275 +++ b/tests/data/test275 @@ -69,6 +69,7 @@ CONNECT remotesite.com.275:%HTTPPORT HTTP/1.1 Host: remotesite.com.275:%HTTPPORT
Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
+Proxy-Connection: Keep-Alive
</proxy> <protocol> diff --git a/tests/data/test278 b/tests/data/test278 index e6f1ef705..3112264a3 100644 --- a/tests/data/test278 +++ b/tests/data/test278 @@ -42,6 +42,7 @@ GET http://we.want.that.site.com/278 HTTP/1.1 Host: we.want.that.site.com
Proxy-Authorization: Basic ZmFrZTo=
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test279 b/tests/data/test279 index 5005daa5a..47f8b687e 100644 --- a/tests/data/test279 +++ b/tests/data/test279 @@ -43,6 +43,7 @@ GET http://we.want.that.site.com/279 HTTP/1.1 Host: we.want.that.site.com
Proxy-Authorization: Basic ZmFrZTo=
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test287 b/tests/data/test287 index 526446f40..6772e220f 100644 --- a/tests/data/test287 +++ b/tests/data/test287 @@ -37,6 +37,7 @@ http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/201 <protocol> CONNECT test.remote.example.com.287:%HTTPPORT HTTP/1.1
Host: test.remote.example.com.287:%HTTPPORT
+Proxy-Connection: Keep-Alive
User-Agent: looser/2007
</protocol> diff --git a/tests/data/test299 b/tests/data/test299 index a7b775569..4daaea47d 100644 --- a/tests/data/test299 +++ b/tests/data/test299 @@ -46,6 +46,7 @@ GET ftp://michal:aybabtu@host.com/we/want/299 HTTP/1.1 Host: host.com:21
Authorization: Basic bWljaGFsOmF5YmFidHU=
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test43 b/tests/data/test43 index dc0dd5fcd..e5535bb3a 100644 --- a/tests/data/test43 +++ b/tests/data/test43 @@ -67,10 +67,12 @@ http://%HOSTIP:%HTTPPORT/want/43 -L -x %HOSTIP:%HTTPPORT GET http://%HOSTIP:%HTTPPORT/want/43 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://%HOSTIP:%HTTPPORT/want/data/430002.txt?coolsite=yes HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test5 b/tests/data/test5 index 13314570b..b62f1a127 100644 --- a/tests/data/test5 +++ b/tests/data/test5 @@ -43,6 +43,7 @@ http://%HOSTIP:%HTTPPORT/we/want/that/page/5#5 -x %HOSTIP:%HTTPPORT GET http://%HOSTIP:%HTTPPORT/we/want/that/page/5 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test503 b/tests/data/test503 index f02bac6f3..e8dc21e8d 100644 --- a/tests/data/test503 +++ b/tests/data/test503 @@ -72,6 +72,7 @@ moo CONNECT machine.503:%HTTPPORT HTTP/1.1
Host: machine.503:%HTTPPORT
Proxy-Authorization: Basic dGVzdDppbmc=
+Proxy-Connection: Keep-Alive
</proxy> <protocol> diff --git a/tests/data/test523 b/tests/data/test523 index d021ae3be..9abe0ed22 100644 --- a/tests/data/test523 +++ b/tests/data/test523 @@ -54,6 +54,7 @@ GET HTTP://www.example.com:19999/523 HTTP/1.1 Host: www.example.com:19999
Authorization: Basic eHh4Onl5eQ==
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <stdout> diff --git a/tests/data/test540 b/tests/data/test540 index 19a13f19e..8decaea9d 100644 --- a/tests/data/test540 +++ b/tests/data/test540 @@ -78,16 +78,19 @@ http://test.remote.example.com/path/540 http://%HOSTIP:%HTTPPORT silly:person cu GET http://test.remote.example.com/path/540 HTTP/1.1
Host: custom.set.host.name
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://test.remote.example.com/path/540 HTTP/1.1
Host: custom.set.host.name
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="/path/540", response="ca507dcf189196b6a5374d3233042261"
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://test.remote.example.com/path/540 HTTP/1.1
Host: custom.set.host.name
Proxy-Authorization: Digest username="silly", realm="weirdorealm", nonce="12345", uri="/path/540", response="ca507dcf189196b6a5374d3233042261"
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test547 b/tests/data/test547 index 7cf3e9197..cee22c6f7 100644 --- a/tests/data/test547 +++ b/tests/data/test547 @@ -106,6 +106,7 @@ POST http://test.remote.example.com/path/547 HTTP/1.1 Host: test.remote.example.com
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
@@ -115,6 +116,7 @@ Host: test.remote.example.com Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
@@ -123,6 +125,7 @@ Host: test.remote.example.com Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
diff --git a/tests/data/test548 b/tests/data/test548 index e9d2262bb..34cf5e2ea 100644 --- a/tests/data/test548 +++ b/tests/data/test548 @@ -106,6 +106,7 @@ POST http://test.remote.example.com/path/548 HTTP/1.1 Host: test.remote.example.com
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
@@ -115,6 +116,7 @@ Host: test.remote.example.com Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
@@ -123,6 +125,7 @@ Host: test.remote.example.com Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
diff --git a/tests/data/test549 b/tests/data/test549 index 59925ce79..a248edbf6 100644 --- a/tests/data/test549 +++ b/tests/data/test549 @@ -55,6 +55,7 @@ ftp://www.example.com/moo/549 http://%HOSTIP:%HTTPPORT GET ftp://www.example.com/moo/549;type=i HTTP/1.1
Host: www.example.com:21
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <stdout> diff --git a/tests/data/test550 b/tests/data/test550 index 9a717ee87..a609aa216 100644 --- a/tests/data/test550 +++ b/tests/data/test550 @@ -55,6 +55,7 @@ ftp://www.example.com/moo/550 http://%HOSTIP:%HTTPPORT ascii GET ftp://www.example.com/moo/550;type=a HTTP/1.1
Host: www.example.com:21
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <stdout> diff --git a/tests/data/test551 b/tests/data/test551 index 6dd013375..ed6aee264 100644 --- a/tests/data/test551 +++ b/tests/data/test551 @@ -81,6 +81,7 @@ http://test.remote.example.com/path/551 http://%HOSTIP:%HTTPPORT s1lly:pers0n POST http://test.remote.example.com/path/551 HTTP/1.1
Host: test.remote.example.com
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
@@ -89,6 +90,7 @@ POST http://test.remote.example.com/path/551 HTTP/1.1 Host: test.remote.example.com
Proxy-Authorization: Digest username="s1lly", realm="something fun to read", nonce="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", uri="/path/551", response="3325240726fbdaf1e61f3a0dd40b930c"
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
diff --git a/tests/data/test552 b/tests/data/test552 Binary files differindex c20e2049f..b44ca3455 100644 --- a/tests/data/test552 +++ b/tests/data/test552 diff --git a/tests/data/test555 b/tests/data/test555 index 6c09e3c1b..0f3bb07fc 100644 --- a/tests/data/test555 +++ b/tests/data/test555 @@ -115,6 +115,7 @@ POST http://test.remote.example.com/path/555 HTTP/1.1 Host: test.remote.example.com
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
@@ -124,6 +125,7 @@ Host: test.remote.example.com Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
@@ -132,6 +134,7 @@ Host: test.remote.example.com Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
diff --git a/tests/data/test557 b/tests/data/test557 index ee2793f56..8d0944a1e 100644 --- a/tests/data/test557 +++ b/tests/data/test557 @@ -39,6 +39,7 @@ All curl_mprintf() signed int tests OK! All curl_mprintf() unsigned long tests OK! All curl_mprintf() signed long tests OK! All curl_mprintf() curl_off_t tests OK! +All curl_mprintf() strings tests OK! </stdout> </verify> diff --git a/tests/data/test558 b/tests/data/test558 index 7a9ba7061..a1ac7d475 100644 --- a/tests/data/test558 +++ b/tests/data/test558 @@ -17,6 +17,7 @@ none </server> <features> TrackMemory +ipv6 </features> # tool is what to use instead of 'curl' <tool> @@ -35,6 +36,8 @@ nothing # Verify data after the test has been "shot" <verify> <file name="log/memdump"> +FD hostip6.c: socket() +FD connect.c: sclose() MEM lib558.c: malloc() MEM lib558.c: free() MEM escape.c: malloc() @@ -46,7 +49,7 @@ MEM escape.c: free() s/ =.*// s/\(.*\)/()/ s/:\d+/:/ -s:^(MEM )(.*/)(.*):$1$3: +s:^(MEM |FD )(.*/)(.*):$1$3: </stripfile> </verify> diff --git a/tests/data/test561 b/tests/data/test561 index 905e756b7..a6188eacf 100644 --- a/tests/data/test561 +++ b/tests/data/test561 @@ -56,6 +56,7 @@ FTP RETR with CURLOPT_PROXY_TRANSFER_MODE, ASCII transfer and type=i GET ftp://www.example.com/moo/561;type=i HTTP/1.1
Host: www.example.com:21
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> <stdout> diff --git a/tests/data/test563 b/tests/data/test563 index e4c00f50f..785152319 100644 --- a/tests/data/test563 +++ b/tests/data/test563 @@ -50,6 +50,7 @@ ftp_proxy=http://%HOSTIP:%HTTPPORT/ GET FTP://%HOSTIP:%FTPPORT/563;type=A HTTP/1.1
Host: %HOSTIP:%FTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test590 b/tests/data/test590 index 334177676..55ea4f0e9 100644 --- a/tests/data/test590 +++ b/tests/data/test590 @@ -104,18 +104,21 @@ GET http://test.remote.example.com/path/590 HTTP/1.1 Host: test.remote.example.com
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://test.remote.example.com/path/590 HTTP/1.1
Host: test.remote.example.com
Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://test.remote.example.com/path/590 HTTP/1.1
Host: test.remote.example.com
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAAAgACAPYAAAAIAAgA+AAAAAAAAAAAAAAABoKBAB3Hr6SDn3NDNkgebbaP88ExMjM0MjIzNFIW4N7aYT44bAIg1jt2blUBAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAbWVjdXJsaG9zdA==
User-Agent: curl/7.13.2-CVS (i686-pc-linux-gnu) libcurl/7.13.2-CVS OpenSSL/0.9.7e zlib/1.2.2 libidn/0.5.13
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test63 b/tests/data/test63 index 2a964492c..ccc19dd24 100644 --- a/tests/data/test63 +++ b/tests/data/test63 @@ -45,6 +45,7 @@ GET http://we.want.that.site.com/63 HTTP/1.1 Host: we.want.that.site.com
Proxy-Authorization: Basic ZmFrZTp1c2Vy
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test79 b/tests/data/test79 index 55fc2459f..b2566e229 100644 --- a/tests/data/test79 +++ b/tests/data/test79 @@ -48,6 +48,7 @@ ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79 -x %HOSTIP:%HTTPPORT GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test80 b/tests/data/test80 index 8a635b45a..147a6aa12 100644 --- a/tests/data/test80 +++ b/tests/data/test80 @@ -68,6 +68,7 @@ CONNECT test.80:%HTTPPORT HTTP/1.0 Host: test.80:%HTTPPORT
Proxy-Authorization: Basic eW91YXJlOnlvdXJzZWxm
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
+Proxy-Connection: Keep-Alive
</proxy> <protocol> diff --git a/tests/data/test81 b/tests/data/test81 index 53affa05f..dc054d293 100644 --- a/tests/data/test81 +++ b/tests/data/test81 @@ -89,12 +89,14 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
GET http://%HOSTIP:%HTTPPORT/81 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAACeAJ4AWAAAAAAAAAD2AAAACAAIAPYAAAAIAAgA/gAAAAAAAAAAAAAABoKBAL9LNW5+nkyHZRmyFaL/LJ4xMjM0MjIzNGUCyhgQ9hw6eWAT13EbDa0BAQAAAAAAAACAPtXesZ0BMTIzNDIyMzQAAAAAAgAEAEMAQwABABIARQBMAEkAUwBBAEIARQBUAEgABAAYAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAMALABlAGwAaQBzAGEAYgBlAHQAaAAuAGMAYwAuAGkAYwBlAGQAZQB2AC4AbgB1AAAAAAAAAAAAdGVzdHVzZXJjdXJsaG9zdA==
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test82 b/tests/data/test82 index de3fcbaea..8b58f75da 100644 --- a/tests/data/test82 +++ b/tests/data/test82 @@ -49,6 +49,7 @@ Host: %HOSTIP:%HTTPPORT Proxy-Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
User-Agent: curl/7.10.6-pre1 (i686-pc-linux-gnu) libcurl/7.10.6-pre1 OpenSSL/0.9.7a ipv6 zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test83 b/tests/data/test83 index 4fe8ba34a..120bcc6a1 100644 --- a/tests/data/test83 +++ b/tests/data/test83 @@ -64,6 +64,7 @@ http://test.83:%HTTPPORT/we/want/that/page/83 -p -x %HOSTIP:%PROXYPORT --user 'i CONNECT test.83:%HTTPPORT HTTP/1.1
Host: test.83:%HTTPPORT
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
+Proxy-Connection: Keep-Alive
</proxy> <protocol> diff --git a/tests/data/test84 b/tests/data/test84 index cf667d67a..629dae2fc 100644 --- a/tests/data/test84 +++ b/tests/data/test84 @@ -47,6 +47,7 @@ Host: %HOSTIP:%HTTPPORT Authorization: Basic aWFtOm15c2VsZg==
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test85 b/tests/data/test85 index a11363f50..cb5e6e052 100644 --- a/tests/data/test85 +++ b/tests/data/test85 @@ -51,6 +51,7 @@ Proxy-Authorization: Basic dGVzdGluZzp0aGlz Authorization: Basic aWFtOm15c2VsZg==
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test93 b/tests/data/test93 index 948d29c4d..138724835 100644 --- a/tests/data/test93 +++ b/tests/data/test93 @@ -43,6 +43,7 @@ http://%HOSTIP:%HTTPPORT/93 -x %HOSTIP:%HTTPPORT GET http://%HOSTIP:%HTTPPORT/93 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test94 b/tests/data/test94 index 94c894cb2..2f3f4824d 100644 --- a/tests/data/test94 +++ b/tests/data/test94 @@ -51,6 +51,7 @@ https://test.anything.really.com:94 --proxy1.0 %HOSTIP:%HTTPPORT CONNECT test.anything.really.com:94 HTTP/1.0
User-Agent: curl/7.11.0-CVS (i686-pc-linux-gnu) libcurl/7.11.0-CVS OpenSSL/0.9.6b ipv6 zlib/1.1.4
Host: test.anything.really.com:94
+Proxy-Connection: Keep-Alive
</protocol> </verify> diff --git a/tests/data/test95 b/tests/data/test95 index 2b3e2c22c..1cd88acab 100644 --- a/tests/data/test95 +++ b/tests/data/test95 @@ -64,6 +64,7 @@ http://test.95:%HTTPPORT/we/want/that/page/95 -p -x %HOSTIP:%PROXYPORT -d "datat CONNECT test.95:%HTTPPORT HTTP/1.1
User-Agent: curl/7.10.7-pre2 (i686-pc-linux-gnu) libcurl/7.10.7-pre2 OpenSSL/0.9.7a zlib/1.1.3
Host: test.95:%HTTPPORT
+Proxy-Connection: Keep-Alive
</proxy> <protocol nonewline="yes"> diff --git a/tests/http2-server.pl b/tests/http2-server.pl new file mode 100755 index 000000000..72ed12e85 --- /dev/null +++ b/tests/http2-server.pl @@ -0,0 +1,75 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +#*************************************************************************** + +# This script invokes nghttpx properly to have it serve HTTP/2 for us. +# nghttpx runs as a proxy in front of our "actual" HTTP/1 server. + +my $pidfile = "log/nghttpx.pid"; +my $logfile = "log/http2.log"; +my $nghttpx = "nghttpx"; +my $listenport = 9015; + +#*************************************************************************** +# Process command line options +# +while(@ARGV) { + if($ARGV[0] eq '--verbose') { + $verbose = 1; + } + elsif($ARGV[0] eq '--pidfile') { + if($ARGV[1]) { + $pidfile = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--nghttpx') { + if($ARGV[1]) { + $nghttpx = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--port') { + if($ARGV[1]) { + $listenport = $ARGV[1]; + shift @ARGV; + } + } + elsif($ARGV[0] eq '--logfile') { + if($ARGV[1]) { + $logfile = $ARGV[1]; + shift @ARGV; + } + } + else { + print STDERR "\nWarning: http2-server.pl unknown parameter: $ARGV[0]\n"; + } + shift @ARGV; +} + +my $cmdline="$nghttpx --backend=127.0.0.1,8990 ". + "--frontend=\"*,$listenport;no-tls\" ". + "--log-level=INFO ". + "--pid-file=$pidfile ". + "--errorlog-file=$logfile"; +print "RUN: $cmdline\n" if($verbose); +system("$cmdline 2>/dev/null"); diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index 87ee56ede..826b3d4f5 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -115,3 +115,6 @@ libhostname_la_SOURCES = sethostname.c sethostname.h libhostname_la_LIBADD = libhostname_la_DEPENDENCIES = + +checksrc: + @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c diff --git a/tests/libtest/Makefile.in b/tests/libtest/Makefile.in index b002dd6bb..eec09b82c 100644 --- a/tests/libtest/Makefile.in +++ b/tests/libtest/Makefile.in @@ -121,10 +121,10 @@ noinst_PROGRAMS = chkhostname$(EXEEXT) libauthretry$(EXEEXT) \ lib1506$(EXEEXT) lib1507$(EXEEXT) lib1508$(EXEEXT) \ lib1509$(EXEEXT) lib1510$(EXEEXT) lib1511$(EXEEXT) \ lib1512$(EXEEXT) lib1513$(EXEEXT) lib1514$(EXEEXT) \ - lib1515$(EXEEXT) lib1520$(EXEEXT) lib1525$(EXEEXT) \ - lib1526$(EXEEXT) lib1527$(EXEEXT) lib1528$(EXEEXT) \ - lib1529$(EXEEXT) lib1530$(EXEEXT) lib1531$(EXEEXT) \ - lib1900$(EXEEXT) lib2033$(EXEEXT) + lib1515$(EXEEXT) lib1517$(EXEEXT) lib1520$(EXEEXT) \ + lib1525$(EXEEXT) lib1526$(EXEEXT) lib1527$(EXEEXT) \ + lib1528$(EXEEXT) lib1529$(EXEEXT) lib1530$(EXEEXT) \ + lib1531$(EXEEXT) lib1900$(EXEEXT) lib2033$(EXEEXT) @USE_CPPFLAG_CURL_STATICLIB_TRUE@am__append_1 = -DCURL_STATICLIB @CURL_LT_SHLIB_USE_NO_UNDEFINED_TRUE@am__append_2 = -no-undefined @CURL_LT_SHLIB_USE_MIMPURE_TEXT_TRUE@am__append_3 = -mimpure-text @@ -289,527 +289,532 @@ am_lib1515_OBJECTS = lib1515-lib1515.$(OBJEXT) $(am__objects_45) \ $(am__objects_46) $(am__objects_47) lib1515_OBJECTS = $(am_lib1515_OBJECTS) lib1515_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_48 = lib1520-first.$(OBJEXT) -am_lib1520_OBJECTS = lib1520-lib1520.$(OBJEXT) $(am__objects_48) +am__objects_48 = lib1517-first.$(OBJEXT) +am_lib1517_OBJECTS = lib1517-lib1517.$(OBJEXT) $(am__objects_48) +lib1517_OBJECTS = $(am_lib1517_OBJECTS) +lib1517_LDADD = $(LDADD) +lib1517_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__objects_49 = lib1520-first.$(OBJEXT) +am_lib1520_OBJECTS = lib1520-lib1520.$(OBJEXT) $(am__objects_49) lib1520_OBJECTS = $(am_lib1520_OBJECTS) lib1520_LDADD = $(LDADD) lib1520_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_49 = lib1525-first.$(OBJEXT) -am__objects_50 = lib1525-testutil.$(OBJEXT) -am__objects_51 = ../../lib/lib1525-warnless.$(OBJEXT) -am_lib1525_OBJECTS = lib1525-lib1525.$(OBJEXT) $(am__objects_49) \ - $(am__objects_50) $(am__objects_51) +am__objects_50 = lib1525-first.$(OBJEXT) +am__objects_51 = lib1525-testutil.$(OBJEXT) +am__objects_52 = ../../lib/lib1525-warnless.$(OBJEXT) +am_lib1525_OBJECTS = lib1525-lib1525.$(OBJEXT) $(am__objects_50) \ + $(am__objects_51) $(am__objects_52) lib1525_OBJECTS = $(am_lib1525_OBJECTS) lib1525_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_52 = lib1526-first.$(OBJEXT) -am__objects_53 = lib1526-testutil.$(OBJEXT) -am__objects_54 = ../../lib/lib1526-warnless.$(OBJEXT) -am_lib1526_OBJECTS = lib1526-lib1526.$(OBJEXT) $(am__objects_52) \ - $(am__objects_53) $(am__objects_54) +am__objects_53 = lib1526-first.$(OBJEXT) +am__objects_54 = lib1526-testutil.$(OBJEXT) +am__objects_55 = ../../lib/lib1526-warnless.$(OBJEXT) +am_lib1526_OBJECTS = lib1526-lib1526.$(OBJEXT) $(am__objects_53) \ + $(am__objects_54) $(am__objects_55) lib1526_OBJECTS = $(am_lib1526_OBJECTS) lib1526_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_55 = lib1527-first.$(OBJEXT) -am__objects_56 = lib1527-testutil.$(OBJEXT) -am__objects_57 = ../../lib/lib1527-warnless.$(OBJEXT) -am_lib1527_OBJECTS = lib1527-lib1527.$(OBJEXT) $(am__objects_55) \ - $(am__objects_56) $(am__objects_57) +am__objects_56 = lib1527-first.$(OBJEXT) +am__objects_57 = lib1527-testutil.$(OBJEXT) +am__objects_58 = ../../lib/lib1527-warnless.$(OBJEXT) +am_lib1527_OBJECTS = lib1527-lib1527.$(OBJEXT) $(am__objects_56) \ + $(am__objects_57) $(am__objects_58) lib1527_OBJECTS = $(am_lib1527_OBJECTS) lib1527_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_58 = lib1528-first.$(OBJEXT) -am__objects_59 = lib1528-testutil.$(OBJEXT) -am__objects_60 = ../../lib/lib1528-warnless.$(OBJEXT) -am_lib1528_OBJECTS = lib1528-lib1528.$(OBJEXT) $(am__objects_58) \ - $(am__objects_59) $(am__objects_60) +am__objects_59 = lib1528-first.$(OBJEXT) +am__objects_60 = lib1528-testutil.$(OBJEXT) +am__objects_61 = ../../lib/lib1528-warnless.$(OBJEXT) +am_lib1528_OBJECTS = lib1528-lib1528.$(OBJEXT) $(am__objects_59) \ + $(am__objects_60) $(am__objects_61) lib1528_OBJECTS = $(am_lib1528_OBJECTS) lib1528_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_61 = lib1529-first.$(OBJEXT) -am__objects_62 = lib1529-testutil.$(OBJEXT) -am__objects_63 = ../../lib/lib1529-warnless.$(OBJEXT) -am_lib1529_OBJECTS = lib1529-lib1529.$(OBJEXT) $(am__objects_61) \ - $(am__objects_62) $(am__objects_63) +am__objects_62 = lib1529-first.$(OBJEXT) +am__objects_63 = lib1529-testutil.$(OBJEXT) +am__objects_64 = ../../lib/lib1529-warnless.$(OBJEXT) +am_lib1529_OBJECTS = lib1529-lib1529.$(OBJEXT) $(am__objects_62) \ + $(am__objects_63) $(am__objects_64) lib1529_OBJECTS = $(am_lib1529_OBJECTS) lib1529_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_64 = lib1530-first.$(OBJEXT) -am__objects_65 = lib1530-testutil.$(OBJEXT) -am__objects_66 = ../../lib/lib1530-warnless.$(OBJEXT) -am_lib1530_OBJECTS = lib1530-lib1530.$(OBJEXT) $(am__objects_64) \ - $(am__objects_65) $(am__objects_66) +am__objects_65 = lib1530-first.$(OBJEXT) +am__objects_66 = lib1530-testutil.$(OBJEXT) +am__objects_67 = ../../lib/lib1530-warnless.$(OBJEXT) +am_lib1530_OBJECTS = lib1530-lib1530.$(OBJEXT) $(am__objects_65) \ + $(am__objects_66) $(am__objects_67) lib1530_OBJECTS = $(am_lib1530_OBJECTS) lib1530_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_67 = lib1531-first.$(OBJEXT) -am__objects_68 = lib1531-testutil.$(OBJEXT) -am__objects_69 = ../../lib/lib1531-warnless.$(OBJEXT) -am_lib1531_OBJECTS = lib1531-lib1531.$(OBJEXT) $(am__objects_67) \ - $(am__objects_68) $(am__objects_69) +am__objects_68 = lib1531-first.$(OBJEXT) +am__objects_69 = lib1531-testutil.$(OBJEXT) +am__objects_70 = ../../lib/lib1531-warnless.$(OBJEXT) +am_lib1531_OBJECTS = lib1531-lib1531.$(OBJEXT) $(am__objects_68) \ + $(am__objects_69) $(am__objects_70) lib1531_OBJECTS = $(am_lib1531_OBJECTS) lib1531_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_70 = lib1900-first.$(OBJEXT) -am__objects_71 = lib1900-testutil.$(OBJEXT) -am__objects_72 = ../../lib/lib1900-warnless.$(OBJEXT) -am_lib1900_OBJECTS = lib1900-lib1900.$(OBJEXT) $(am__objects_70) \ - $(am__objects_71) $(am__objects_72) +am__objects_71 = lib1900-first.$(OBJEXT) +am__objects_72 = lib1900-testutil.$(OBJEXT) +am__objects_73 = ../../lib/lib1900-warnless.$(OBJEXT) +am_lib1900_OBJECTS = lib1900-lib1900.$(OBJEXT) $(am__objects_71) \ + $(am__objects_72) $(am__objects_73) lib1900_OBJECTS = $(am_lib1900_OBJECTS) lib1900_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_73 = lib2033-first.$(OBJEXT) -am__objects_74 = lib2033-testutil.$(OBJEXT) -am__objects_75 = ../../lib/lib2033-warnless.$(OBJEXT) +am__objects_74 = lib2033-first.$(OBJEXT) +am__objects_75 = lib2033-testutil.$(OBJEXT) +am__objects_76 = ../../lib/lib2033-warnless.$(OBJEXT) am_lib2033_OBJECTS = lib2033-libntlmconnect.$(OBJEXT) \ - $(am__objects_73) $(am__objects_74) $(am__objects_75) + $(am__objects_74) $(am__objects_75) $(am__objects_76) lib2033_OBJECTS = $(am_lib2033_OBJECTS) lib2033_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_76 = lib500-first.$(OBJEXT) -am__objects_77 = lib500-testutil.$(OBJEXT) -am__objects_78 = lib500-testtrace.$(OBJEXT) -am_lib500_OBJECTS = lib500-lib500.$(OBJEXT) $(am__objects_76) \ - $(am__objects_77) $(am__objects_78) +am__objects_77 = lib500-first.$(OBJEXT) +am__objects_78 = lib500-testutil.$(OBJEXT) +am__objects_79 = lib500-testtrace.$(OBJEXT) +am_lib500_OBJECTS = lib500-lib500.$(OBJEXT) $(am__objects_77) \ + $(am__objects_78) $(am__objects_79) lib500_OBJECTS = $(am_lib500_OBJECTS) lib500_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_79 = lib501-first.$(OBJEXT) -am_lib501_OBJECTS = lib501-lib501.$(OBJEXT) $(am__objects_79) +am__objects_80 = lib501-first.$(OBJEXT) +am_lib501_OBJECTS = lib501-lib501.$(OBJEXT) $(am__objects_80) lib501_OBJECTS = $(am_lib501_OBJECTS) lib501_LDADD = $(LDADD) lib501_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_80 = lib502-first.$(OBJEXT) -am__objects_81 = lib502-testutil.$(OBJEXT) -am__objects_82 = ../../lib/lib502-warnless.$(OBJEXT) -am_lib502_OBJECTS = lib502-lib502.$(OBJEXT) $(am__objects_80) \ - $(am__objects_81) $(am__objects_82) +am__objects_81 = lib502-first.$(OBJEXT) +am__objects_82 = lib502-testutil.$(OBJEXT) +am__objects_83 = ../../lib/lib502-warnless.$(OBJEXT) +am_lib502_OBJECTS = lib502-lib502.$(OBJEXT) $(am__objects_81) \ + $(am__objects_82) $(am__objects_83) lib502_OBJECTS = $(am_lib502_OBJECTS) lib502_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_83 = lib503-first.$(OBJEXT) -am__objects_84 = lib503-testutil.$(OBJEXT) -am__objects_85 = ../../lib/lib503-warnless.$(OBJEXT) -am_lib503_OBJECTS = lib503-lib503.$(OBJEXT) $(am__objects_83) \ - $(am__objects_84) $(am__objects_85) +am__objects_84 = lib503-first.$(OBJEXT) +am__objects_85 = lib503-testutil.$(OBJEXT) +am__objects_86 = ../../lib/lib503-warnless.$(OBJEXT) +am_lib503_OBJECTS = lib503-lib503.$(OBJEXT) $(am__objects_84) \ + $(am__objects_85) $(am__objects_86) lib503_OBJECTS = $(am_lib503_OBJECTS) lib503_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_86 = lib504-first.$(OBJEXT) -am__objects_87 = lib504-testutil.$(OBJEXT) -am__objects_88 = ../../lib/lib504-warnless.$(OBJEXT) -am_lib504_OBJECTS = lib504-lib504.$(OBJEXT) $(am__objects_86) \ - $(am__objects_87) $(am__objects_88) +am__objects_87 = lib504-first.$(OBJEXT) +am__objects_88 = lib504-testutil.$(OBJEXT) +am__objects_89 = ../../lib/lib504-warnless.$(OBJEXT) +am_lib504_OBJECTS = lib504-lib504.$(OBJEXT) $(am__objects_87) \ + $(am__objects_88) $(am__objects_89) lib504_OBJECTS = $(am_lib504_OBJECTS) lib504_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_89 = lib505-first.$(OBJEXT) -am_lib505_OBJECTS = lib505-lib505.$(OBJEXT) $(am__objects_89) +am__objects_90 = lib505-first.$(OBJEXT) +am_lib505_OBJECTS = lib505-lib505.$(OBJEXT) $(am__objects_90) lib505_OBJECTS = $(am_lib505_OBJECTS) lib505_LDADD = $(LDADD) lib505_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_90 = lib506-first.$(OBJEXT) -am_lib506_OBJECTS = lib506-lib506.$(OBJEXT) $(am__objects_90) +am__objects_91 = lib506-first.$(OBJEXT) +am_lib506_OBJECTS = lib506-lib506.$(OBJEXT) $(am__objects_91) lib506_OBJECTS = $(am_lib506_OBJECTS) lib506_LDADD = $(LDADD) lib506_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_91 = lib507-first.$(OBJEXT) -am__objects_92 = lib507-testutil.$(OBJEXT) -am__objects_93 = ../../lib/lib507-warnless.$(OBJEXT) -am_lib507_OBJECTS = lib507-lib507.$(OBJEXT) $(am__objects_91) \ - $(am__objects_92) $(am__objects_93) +am__objects_92 = lib507-first.$(OBJEXT) +am__objects_93 = lib507-testutil.$(OBJEXT) +am__objects_94 = ../../lib/lib507-warnless.$(OBJEXT) +am_lib507_OBJECTS = lib507-lib507.$(OBJEXT) $(am__objects_92) \ + $(am__objects_93) $(am__objects_94) lib507_OBJECTS = $(am_lib507_OBJECTS) lib507_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_94 = lib508-first.$(OBJEXT) -am_lib508_OBJECTS = lib508-lib508.$(OBJEXT) $(am__objects_94) +am__objects_95 = lib508-first.$(OBJEXT) +am_lib508_OBJECTS = lib508-lib508.$(OBJEXT) $(am__objects_95) lib508_OBJECTS = $(am_lib508_OBJECTS) lib508_LDADD = $(LDADD) lib508_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_95 = lib509-first.$(OBJEXT) -am_lib509_OBJECTS = lib509-lib509.$(OBJEXT) $(am__objects_95) +am__objects_96 = lib509-first.$(OBJEXT) +am_lib509_OBJECTS = lib509-lib509.$(OBJEXT) $(am__objects_96) lib509_OBJECTS = $(am_lib509_OBJECTS) lib509_LDADD = $(LDADD) lib509_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_96 = lib510-first.$(OBJEXT) -am_lib510_OBJECTS = lib510-lib510.$(OBJEXT) $(am__objects_96) +am__objects_97 = lib510-first.$(OBJEXT) +am_lib510_OBJECTS = lib510-lib510.$(OBJEXT) $(am__objects_97) lib510_OBJECTS = $(am_lib510_OBJECTS) lib510_LDADD = $(LDADD) lib510_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_97 = lib511-first.$(OBJEXT) -am_lib511_OBJECTS = lib511-lib511.$(OBJEXT) $(am__objects_97) +am__objects_98 = lib511-first.$(OBJEXT) +am_lib511_OBJECTS = lib511-lib511.$(OBJEXT) $(am__objects_98) lib511_OBJECTS = $(am_lib511_OBJECTS) lib511_LDADD = $(LDADD) lib511_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_98 = lib512-first.$(OBJEXT) -am_lib512_OBJECTS = lib512-lib512.$(OBJEXT) $(am__objects_98) +am__objects_99 = lib512-first.$(OBJEXT) +am_lib512_OBJECTS = lib512-lib512.$(OBJEXT) $(am__objects_99) lib512_OBJECTS = $(am_lib512_OBJECTS) lib512_LDADD = $(LDADD) lib512_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_99 = lib513-first.$(OBJEXT) -am_lib513_OBJECTS = lib513-lib513.$(OBJEXT) $(am__objects_99) +am__objects_100 = lib513-first.$(OBJEXT) +am_lib513_OBJECTS = lib513-lib513.$(OBJEXT) $(am__objects_100) lib513_OBJECTS = $(am_lib513_OBJECTS) lib513_LDADD = $(LDADD) lib513_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_100 = lib514-first.$(OBJEXT) -am_lib514_OBJECTS = lib514-lib514.$(OBJEXT) $(am__objects_100) +am__objects_101 = lib514-first.$(OBJEXT) +am_lib514_OBJECTS = lib514-lib514.$(OBJEXT) $(am__objects_101) lib514_OBJECTS = $(am_lib514_OBJECTS) lib514_LDADD = $(LDADD) lib514_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_101 = lib515-first.$(OBJEXT) -am_lib515_OBJECTS = lib515-lib515.$(OBJEXT) $(am__objects_101) +am__objects_102 = lib515-first.$(OBJEXT) +am_lib515_OBJECTS = lib515-lib515.$(OBJEXT) $(am__objects_102) lib515_OBJECTS = $(am_lib515_OBJECTS) lib515_LDADD = $(LDADD) lib515_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_102 = lib516-first.$(OBJEXT) -am_lib516_OBJECTS = lib516-lib516.$(OBJEXT) $(am__objects_102) +am__objects_103 = lib516-first.$(OBJEXT) +am_lib516_OBJECTS = lib516-lib516.$(OBJEXT) $(am__objects_103) lib516_OBJECTS = $(am_lib516_OBJECTS) lib516_LDADD = $(LDADD) lib516_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_103 = lib517-first.$(OBJEXT) -am_lib517_OBJECTS = lib517-lib517.$(OBJEXT) $(am__objects_103) +am__objects_104 = lib517-first.$(OBJEXT) +am_lib517_OBJECTS = lib517-lib517.$(OBJEXT) $(am__objects_104) lib517_OBJECTS = $(am_lib517_OBJECTS) lib517_LDADD = $(LDADD) lib517_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_104 = lib518-first.$(OBJEXT) -am__objects_105 = ../../lib/lib518-warnless.$(OBJEXT) -am_lib518_OBJECTS = lib518-lib518.$(OBJEXT) $(am__objects_104) \ - $(am__objects_105) +am__objects_105 = lib518-first.$(OBJEXT) +am__objects_106 = ../../lib/lib518-warnless.$(OBJEXT) +am_lib518_OBJECTS = lib518-lib518.$(OBJEXT) $(am__objects_105) \ + $(am__objects_106) lib518_OBJECTS = $(am_lib518_OBJECTS) lib518_LDADD = $(LDADD) lib518_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_106 = lib519-first.$(OBJEXT) -am_lib519_OBJECTS = lib519-lib519.$(OBJEXT) $(am__objects_106) +am__objects_107 = lib519-first.$(OBJEXT) +am_lib519_OBJECTS = lib519-lib519.$(OBJEXT) $(am__objects_107) lib519_OBJECTS = $(am_lib519_OBJECTS) lib519_LDADD = $(LDADD) lib519_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_107 = lib520-first.$(OBJEXT) -am_lib520_OBJECTS = lib520-lib520.$(OBJEXT) $(am__objects_107) +am__objects_108 = lib520-first.$(OBJEXT) +am_lib520_OBJECTS = lib520-lib520.$(OBJEXT) $(am__objects_108) lib520_OBJECTS = $(am_lib520_OBJECTS) lib520_LDADD = $(LDADD) lib520_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_108 = lib521-first.$(OBJEXT) -am_lib521_OBJECTS = lib521-lib521.$(OBJEXT) $(am__objects_108) +am__objects_109 = lib521-first.$(OBJEXT) +am_lib521_OBJECTS = lib521-lib521.$(OBJEXT) $(am__objects_109) lib521_OBJECTS = $(am_lib521_OBJECTS) lib521_LDADD = $(LDADD) lib521_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_109 = lib523-first.$(OBJEXT) -am_lib523_OBJECTS = lib523-lib523.$(OBJEXT) $(am__objects_109) +am__objects_110 = lib523-first.$(OBJEXT) +am_lib523_OBJECTS = lib523-lib523.$(OBJEXT) $(am__objects_110) lib523_OBJECTS = $(am_lib523_OBJECTS) lib523_LDADD = $(LDADD) lib523_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_110 = lib524-first.$(OBJEXT) -am_lib524_OBJECTS = lib524-lib524.$(OBJEXT) $(am__objects_110) +am__objects_111 = lib524-first.$(OBJEXT) +am_lib524_OBJECTS = lib524-lib524.$(OBJEXT) $(am__objects_111) lib524_OBJECTS = $(am_lib524_OBJECTS) lib524_LDADD = $(LDADD) lib524_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_111 = lib525-first.$(OBJEXT) -am__objects_112 = lib525-testutil.$(OBJEXT) -am__objects_113 = ../../lib/lib525-warnless.$(OBJEXT) -am_lib525_OBJECTS = lib525-lib525.$(OBJEXT) $(am__objects_111) \ - $(am__objects_112) $(am__objects_113) +am__objects_112 = lib525-first.$(OBJEXT) +am__objects_113 = lib525-testutil.$(OBJEXT) +am__objects_114 = ../../lib/lib525-warnless.$(OBJEXT) +am_lib525_OBJECTS = lib525-lib525.$(OBJEXT) $(am__objects_112) \ + $(am__objects_113) $(am__objects_114) lib525_OBJECTS = $(am_lib525_OBJECTS) lib525_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_114 = lib526-first.$(OBJEXT) -am__objects_115 = lib526-testutil.$(OBJEXT) -am__objects_116 = ../../lib/lib526-warnless.$(OBJEXT) -am_lib526_OBJECTS = lib526-lib526.$(OBJEXT) $(am__objects_114) \ - $(am__objects_115) $(am__objects_116) +am__objects_115 = lib526-first.$(OBJEXT) +am__objects_116 = lib526-testutil.$(OBJEXT) +am__objects_117 = ../../lib/lib526-warnless.$(OBJEXT) +am_lib526_OBJECTS = lib526-lib526.$(OBJEXT) $(am__objects_115) \ + $(am__objects_116) $(am__objects_117) lib526_OBJECTS = $(am_lib526_OBJECTS) lib526_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_117 = lib527-first.$(OBJEXT) -am__objects_118 = lib527-testutil.$(OBJEXT) -am__objects_119 = ../../lib/lib527-warnless.$(OBJEXT) -am_lib527_OBJECTS = lib527-lib526.$(OBJEXT) $(am__objects_117) \ - $(am__objects_118) $(am__objects_119) +am__objects_118 = lib527-first.$(OBJEXT) +am__objects_119 = lib527-testutil.$(OBJEXT) +am__objects_120 = ../../lib/lib527-warnless.$(OBJEXT) +am_lib527_OBJECTS = lib527-lib526.$(OBJEXT) $(am__objects_118) \ + $(am__objects_119) $(am__objects_120) lib527_OBJECTS = $(am_lib527_OBJECTS) lib527_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_120 = lib529-first.$(OBJEXT) -am__objects_121 = lib529-testutil.$(OBJEXT) -am__objects_122 = ../../lib/lib529-warnless.$(OBJEXT) -am_lib529_OBJECTS = lib529-lib525.$(OBJEXT) $(am__objects_120) \ - $(am__objects_121) $(am__objects_122) +am__objects_121 = lib529-first.$(OBJEXT) +am__objects_122 = lib529-testutil.$(OBJEXT) +am__objects_123 = ../../lib/lib529-warnless.$(OBJEXT) +am_lib529_OBJECTS = lib529-lib525.$(OBJEXT) $(am__objects_121) \ + $(am__objects_122) $(am__objects_123) lib529_OBJECTS = $(am_lib529_OBJECTS) lib529_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_123 = lib530-first.$(OBJEXT) -am__objects_124 = lib530-testutil.$(OBJEXT) -am__objects_125 = ../../lib/lib530-warnless.$(OBJEXT) -am_lib530_OBJECTS = lib530-lib530.$(OBJEXT) $(am__objects_123) \ - $(am__objects_124) $(am__objects_125) +am__objects_124 = lib530-first.$(OBJEXT) +am__objects_125 = lib530-testutil.$(OBJEXT) +am__objects_126 = ../../lib/lib530-warnless.$(OBJEXT) +am_lib530_OBJECTS = lib530-lib530.$(OBJEXT) $(am__objects_124) \ + $(am__objects_125) $(am__objects_126) lib530_OBJECTS = $(am_lib530_OBJECTS) lib530_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_126 = lib532-first.$(OBJEXT) -am__objects_127 = lib532-testutil.$(OBJEXT) -am__objects_128 = ../../lib/lib532-warnless.$(OBJEXT) -am_lib532_OBJECTS = lib532-lib526.$(OBJEXT) $(am__objects_126) \ - $(am__objects_127) $(am__objects_128) +am__objects_127 = lib532-first.$(OBJEXT) +am__objects_128 = lib532-testutil.$(OBJEXT) +am__objects_129 = ../../lib/lib532-warnless.$(OBJEXT) +am_lib532_OBJECTS = lib532-lib526.$(OBJEXT) $(am__objects_127) \ + $(am__objects_128) $(am__objects_129) lib532_OBJECTS = $(am_lib532_OBJECTS) lib532_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_129 = lib533-first.$(OBJEXT) -am__objects_130 = lib533-testutil.$(OBJEXT) -am__objects_131 = ../../lib/lib533-warnless.$(OBJEXT) -am_lib533_OBJECTS = lib533-lib533.$(OBJEXT) $(am__objects_129) \ - $(am__objects_130) $(am__objects_131) +am__objects_130 = lib533-first.$(OBJEXT) +am__objects_131 = lib533-testutil.$(OBJEXT) +am__objects_132 = ../../lib/lib533-warnless.$(OBJEXT) +am_lib533_OBJECTS = lib533-lib533.$(OBJEXT) $(am__objects_130) \ + $(am__objects_131) $(am__objects_132) lib533_OBJECTS = $(am_lib533_OBJECTS) lib533_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_132 = lib536-first.$(OBJEXT) -am__objects_133 = lib536-testutil.$(OBJEXT) -am__objects_134 = ../../lib/lib536-warnless.$(OBJEXT) -am_lib536_OBJECTS = lib536-lib536.$(OBJEXT) $(am__objects_132) \ - $(am__objects_133) $(am__objects_134) +am__objects_133 = lib536-first.$(OBJEXT) +am__objects_134 = lib536-testutil.$(OBJEXT) +am__objects_135 = ../../lib/lib536-warnless.$(OBJEXT) +am_lib536_OBJECTS = lib536-lib536.$(OBJEXT) $(am__objects_133) \ + $(am__objects_134) $(am__objects_135) lib536_OBJECTS = $(am_lib536_OBJECTS) lib536_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_135 = lib537-first.$(OBJEXT) -am__objects_136 = ../../lib/lib537-warnless.$(OBJEXT) -am_lib537_OBJECTS = lib537-lib537.$(OBJEXT) $(am__objects_135) \ - $(am__objects_136) +am__objects_136 = lib537-first.$(OBJEXT) +am__objects_137 = ../../lib/lib537-warnless.$(OBJEXT) +am_lib537_OBJECTS = lib537-lib537.$(OBJEXT) $(am__objects_136) \ + $(am__objects_137) lib537_OBJECTS = $(am_lib537_OBJECTS) lib537_LDADD = $(LDADD) lib537_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_137 = lib539-first.$(OBJEXT) -am_lib539_OBJECTS = lib539-lib539.$(OBJEXT) $(am__objects_137) +am__objects_138 = lib539-first.$(OBJEXT) +am_lib539_OBJECTS = lib539-lib539.$(OBJEXT) $(am__objects_138) lib539_OBJECTS = $(am_lib539_OBJECTS) lib539_LDADD = $(LDADD) lib539_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_138 = lib540-first.$(OBJEXT) -am__objects_139 = lib540-testutil.$(OBJEXT) -am__objects_140 = ../../lib/lib540-warnless.$(OBJEXT) -am_lib540_OBJECTS = lib540-lib540.$(OBJEXT) $(am__objects_138) \ - $(am__objects_139) $(am__objects_140) +am__objects_139 = lib540-first.$(OBJEXT) +am__objects_140 = lib540-testutil.$(OBJEXT) +am__objects_141 = ../../lib/lib540-warnless.$(OBJEXT) +am_lib540_OBJECTS = lib540-lib540.$(OBJEXT) $(am__objects_139) \ + $(am__objects_140) $(am__objects_141) lib540_OBJECTS = $(am_lib540_OBJECTS) lib540_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_141 = lib541-first.$(OBJEXT) -am_lib541_OBJECTS = lib541-lib541.$(OBJEXT) $(am__objects_141) +am__objects_142 = lib541-first.$(OBJEXT) +am_lib541_OBJECTS = lib541-lib541.$(OBJEXT) $(am__objects_142) lib541_OBJECTS = $(am_lib541_OBJECTS) lib541_LDADD = $(LDADD) lib541_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_142 = lib542-first.$(OBJEXT) -am_lib542_OBJECTS = lib542-lib542.$(OBJEXT) $(am__objects_142) +am__objects_143 = lib542-first.$(OBJEXT) +am_lib542_OBJECTS = lib542-lib542.$(OBJEXT) $(am__objects_143) lib542_OBJECTS = $(am_lib542_OBJECTS) lib542_LDADD = $(LDADD) lib542_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_143 = lib543-first.$(OBJEXT) -am_lib543_OBJECTS = lib543-lib543.$(OBJEXT) $(am__objects_143) +am__objects_144 = lib543-first.$(OBJEXT) +am_lib543_OBJECTS = lib543-lib543.$(OBJEXT) $(am__objects_144) lib543_OBJECTS = $(am_lib543_OBJECTS) lib543_LDADD = $(LDADD) lib543_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_144 = lib544-first.$(OBJEXT) -am_lib544_OBJECTS = lib544-lib544.$(OBJEXT) $(am__objects_144) +am__objects_145 = lib544-first.$(OBJEXT) +am_lib544_OBJECTS = lib544-lib544.$(OBJEXT) $(am__objects_145) lib544_OBJECTS = $(am_lib544_OBJECTS) lib544_LDADD = $(LDADD) lib544_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_145 = lib545-first.$(OBJEXT) -am_lib545_OBJECTS = lib545-lib544.$(OBJEXT) $(am__objects_145) +am__objects_146 = lib545-first.$(OBJEXT) +am_lib545_OBJECTS = lib545-lib544.$(OBJEXT) $(am__objects_146) lib545_OBJECTS = $(am_lib545_OBJECTS) lib545_LDADD = $(LDADD) lib545_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_146 = lib547-first.$(OBJEXT) -am_lib547_OBJECTS = lib547-lib547.$(OBJEXT) $(am__objects_146) +am__objects_147 = lib547-first.$(OBJEXT) +am_lib547_OBJECTS = lib547-lib547.$(OBJEXT) $(am__objects_147) lib547_OBJECTS = $(am_lib547_OBJECTS) lib547_LDADD = $(LDADD) lib547_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_147 = lib548-first.$(OBJEXT) -am_lib548_OBJECTS = lib548-lib547.$(OBJEXT) $(am__objects_147) +am__objects_148 = lib548-first.$(OBJEXT) +am_lib548_OBJECTS = lib548-lib547.$(OBJEXT) $(am__objects_148) lib548_OBJECTS = $(am_lib548_OBJECTS) lib548_LDADD = $(LDADD) lib548_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_148 = lib549-first.$(OBJEXT) -am_lib549_OBJECTS = lib549-lib549.$(OBJEXT) $(am__objects_148) +am__objects_149 = lib549-first.$(OBJEXT) +am_lib549_OBJECTS = lib549-lib549.$(OBJEXT) $(am__objects_149) lib549_OBJECTS = $(am_lib549_OBJECTS) lib549_LDADD = $(LDADD) lib549_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_149 = lib552-first.$(OBJEXT) -am__objects_150 = ../../lib/lib552-warnless.$(OBJEXT) -am_lib552_OBJECTS = lib552-lib552.$(OBJEXT) $(am__objects_149) \ - $(am__objects_150) +am__objects_150 = lib552-first.$(OBJEXT) +am__objects_151 = ../../lib/lib552-warnless.$(OBJEXT) +am_lib552_OBJECTS = lib552-lib552.$(OBJEXT) $(am__objects_150) \ + $(am__objects_151) lib552_OBJECTS = $(am_lib552_OBJECTS) lib552_LDADD = $(LDADD) lib552_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_151 = lib553-first.$(OBJEXT) -am_lib553_OBJECTS = lib553-lib553.$(OBJEXT) $(am__objects_151) +am__objects_152 = lib553-first.$(OBJEXT) +am_lib553_OBJECTS = lib553-lib553.$(OBJEXT) $(am__objects_152) lib553_OBJECTS = $(am_lib553_OBJECTS) lib553_LDADD = $(LDADD) lib553_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_152 = lib554-first.$(OBJEXT) -am_lib554_OBJECTS = lib554-lib554.$(OBJEXT) $(am__objects_152) +am__objects_153 = lib554-first.$(OBJEXT) +am_lib554_OBJECTS = lib554-lib554.$(OBJEXT) $(am__objects_153) lib554_OBJECTS = $(am_lib554_OBJECTS) lib554_LDADD = $(LDADD) lib554_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_153 = lib555-first.$(OBJEXT) -am__objects_154 = lib555-testutil.$(OBJEXT) -am__objects_155 = ../../lib/lib555-warnless.$(OBJEXT) -am_lib555_OBJECTS = lib555-lib555.$(OBJEXT) $(am__objects_153) \ - $(am__objects_154) $(am__objects_155) +am__objects_154 = lib555-first.$(OBJEXT) +am__objects_155 = lib555-testutil.$(OBJEXT) +am__objects_156 = ../../lib/lib555-warnless.$(OBJEXT) +am_lib555_OBJECTS = lib555-lib555.$(OBJEXT) $(am__objects_154) \ + $(am__objects_155) $(am__objects_156) lib555_OBJECTS = $(am_lib555_OBJECTS) lib555_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_156 = lib556-first.$(OBJEXT) -am__objects_157 = ../../lib/lib556-warnless.$(OBJEXT) -am_lib556_OBJECTS = lib556-lib556.$(OBJEXT) $(am__objects_156) \ - $(am__objects_157) +am__objects_157 = lib556-first.$(OBJEXT) +am__objects_158 = ../../lib/lib556-warnless.$(OBJEXT) +am_lib556_OBJECTS = lib556-lib556.$(OBJEXT) $(am__objects_157) \ + $(am__objects_158) lib556_OBJECTS = $(am_lib556_OBJECTS) lib556_LDADD = $(LDADD) lib556_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_158 = lib557-first.$(OBJEXT) -am_lib557_OBJECTS = lib557-lib557.$(OBJEXT) $(am__objects_158) +am__objects_159 = lib557-first.$(OBJEXT) +am_lib557_OBJECTS = lib557-lib557.$(OBJEXT) $(am__objects_159) lib557_OBJECTS = $(am_lib557_OBJECTS) lib557_LDADD = $(LDADD) lib557_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_159 = lib558-first.$(OBJEXT) -am_lib558_OBJECTS = lib558-lib558.$(OBJEXT) $(am__objects_159) +am__objects_160 = lib558-first.$(OBJEXT) +am_lib558_OBJECTS = lib558-lib558.$(OBJEXT) $(am__objects_160) lib558_OBJECTS = $(am_lib558_OBJECTS) lib558_LDADD = $(LDADD) lib558_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_160 = lib560-first.$(OBJEXT) -am__objects_161 = lib560-testutil.$(OBJEXT) -am__objects_162 = ../../lib/lib560-warnless.$(OBJEXT) -am_lib560_OBJECTS = lib560-lib560.$(OBJEXT) $(am__objects_160) \ - $(am__objects_161) $(am__objects_162) +am__objects_161 = lib560-first.$(OBJEXT) +am__objects_162 = lib560-testutil.$(OBJEXT) +am__objects_163 = ../../lib/lib560-warnless.$(OBJEXT) +am_lib560_OBJECTS = lib560-lib560.$(OBJEXT) $(am__objects_161) \ + $(am__objects_162) $(am__objects_163) lib560_OBJECTS = $(am_lib560_OBJECTS) lib560_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_163 = lib562-first.$(OBJEXT) -am_lib562_OBJECTS = lib562-lib562.$(OBJEXT) $(am__objects_163) +am__objects_164 = lib562-first.$(OBJEXT) +am_lib562_OBJECTS = lib562-lib562.$(OBJEXT) $(am__objects_164) lib562_OBJECTS = $(am_lib562_OBJECTS) lib562_LDADD = $(LDADD) lib562_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_164 = lib564-first.$(OBJEXT) -am__objects_165 = lib564-testutil.$(OBJEXT) -am__objects_166 = ../../lib/lib564-warnless.$(OBJEXT) -am_lib564_OBJECTS = lib564-lib564.$(OBJEXT) $(am__objects_164) \ - $(am__objects_165) $(am__objects_166) +am__objects_165 = lib564-first.$(OBJEXT) +am__objects_166 = lib564-testutil.$(OBJEXT) +am__objects_167 = ../../lib/lib564-warnless.$(OBJEXT) +am_lib564_OBJECTS = lib564-lib564.$(OBJEXT) $(am__objects_165) \ + $(am__objects_166) $(am__objects_167) lib564_OBJECTS = $(am_lib564_OBJECTS) lib564_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_167 = lib565-first.$(OBJEXT) -am_lib565_OBJECTS = lib565-lib510.$(OBJEXT) $(am__objects_167) +am__objects_168 = lib565-first.$(OBJEXT) +am_lib565_OBJECTS = lib565-lib510.$(OBJEXT) $(am__objects_168) lib565_OBJECTS = $(am_lib565_OBJECTS) lib565_LDADD = $(LDADD) lib565_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_168 = lib566-first.$(OBJEXT) -am_lib566_OBJECTS = lib566-lib566.$(OBJEXT) $(am__objects_168) +am__objects_169 = lib566-first.$(OBJEXT) +am_lib566_OBJECTS = lib566-lib566.$(OBJEXT) $(am__objects_169) lib566_OBJECTS = $(am_lib566_OBJECTS) lib566_LDADD = $(LDADD) lib566_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_169 = lib567-first.$(OBJEXT) -am_lib567_OBJECTS = lib567-lib567.$(OBJEXT) $(am__objects_169) +am__objects_170 = lib567-first.$(OBJEXT) +am_lib567_OBJECTS = lib567-lib567.$(OBJEXT) $(am__objects_170) lib567_OBJECTS = $(am_lib567_OBJECTS) lib567_LDADD = $(LDADD) lib567_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_170 = lib568-first.$(OBJEXT) -am_lib568_OBJECTS = lib568-lib568.$(OBJEXT) $(am__objects_170) +am__objects_171 = lib568-first.$(OBJEXT) +am_lib568_OBJECTS = lib568-lib568.$(OBJEXT) $(am__objects_171) lib568_OBJECTS = $(am_lib568_OBJECTS) lib568_LDADD = $(LDADD) lib568_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_171 = lib569-first.$(OBJEXT) -am_lib569_OBJECTS = lib569-lib569.$(OBJEXT) $(am__objects_171) +am__objects_172 = lib569-first.$(OBJEXT) +am_lib569_OBJECTS = lib569-lib569.$(OBJEXT) $(am__objects_172) lib569_OBJECTS = $(am_lib569_OBJECTS) lib569_LDADD = $(LDADD) lib569_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_172 = lib570-first.$(OBJEXT) -am_lib570_OBJECTS = lib570-lib570.$(OBJEXT) $(am__objects_172) +am__objects_173 = lib570-first.$(OBJEXT) +am_lib570_OBJECTS = lib570-lib570.$(OBJEXT) $(am__objects_173) lib570_OBJECTS = $(am_lib570_OBJECTS) lib570_LDADD = $(LDADD) lib570_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_173 = lib571-first.$(OBJEXT) -am__objects_174 = ../../lib/lib571-warnless.$(OBJEXT) -am_lib571_OBJECTS = lib571-lib571.$(OBJEXT) $(am__objects_173) \ - $(am__objects_174) +am__objects_174 = lib571-first.$(OBJEXT) +am__objects_175 = ../../lib/lib571-warnless.$(OBJEXT) +am_lib571_OBJECTS = lib571-lib571.$(OBJEXT) $(am__objects_174) \ + $(am__objects_175) lib571_OBJECTS = $(am_lib571_OBJECTS) lib571_LDADD = $(LDADD) lib571_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_175 = lib572-first.$(OBJEXT) -am_lib572_OBJECTS = lib572-lib572.$(OBJEXT) $(am__objects_175) +am__objects_176 = lib572-first.$(OBJEXT) +am_lib572_OBJECTS = lib572-lib572.$(OBJEXT) $(am__objects_176) lib572_OBJECTS = $(am_lib572_OBJECTS) lib572_LDADD = $(LDADD) lib572_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_176 = lib573-first.$(OBJEXT) -am__objects_177 = lib573-testutil.$(OBJEXT) -am__objects_178 = ../../lib/lib573-warnless.$(OBJEXT) -am__objects_179 = lib573-testtrace.$(OBJEXT) -am_lib573_OBJECTS = lib573-lib573.$(OBJEXT) $(am__objects_176) \ - $(am__objects_177) $(am__objects_178) $(am__objects_179) +am__objects_177 = lib573-first.$(OBJEXT) +am__objects_178 = lib573-testutil.$(OBJEXT) +am__objects_179 = ../../lib/lib573-warnless.$(OBJEXT) +am__objects_180 = lib573-testtrace.$(OBJEXT) +am_lib573_OBJECTS = lib573-lib573.$(OBJEXT) $(am__objects_177) \ + $(am__objects_178) $(am__objects_179) $(am__objects_180) lib573_OBJECTS = $(am_lib573_OBJECTS) lib573_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_180 = lib574-first.$(OBJEXT) -am_lib574_OBJECTS = lib574-lib574.$(OBJEXT) $(am__objects_180) +am__objects_181 = lib574-first.$(OBJEXT) +am_lib574_OBJECTS = lib574-lib574.$(OBJEXT) $(am__objects_181) lib574_OBJECTS = $(am_lib574_OBJECTS) lib574_LDADD = $(LDADD) lib574_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_181 = lib575-first.$(OBJEXT) -am__objects_182 = lib575-testutil.$(OBJEXT) -am__objects_183 = ../../lib/lib575-warnless.$(OBJEXT) -am_lib575_OBJECTS = lib575-lib575.$(OBJEXT) $(am__objects_181) \ - $(am__objects_182) $(am__objects_183) +am__objects_182 = lib575-first.$(OBJEXT) +am__objects_183 = lib575-testutil.$(OBJEXT) +am__objects_184 = ../../lib/lib575-warnless.$(OBJEXT) +am_lib575_OBJECTS = lib575-lib575.$(OBJEXT) $(am__objects_182) \ + $(am__objects_183) $(am__objects_184) lib575_OBJECTS = $(am_lib575_OBJECTS) lib575_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_184 = lib576-first.$(OBJEXT) -am_lib576_OBJECTS = lib576-lib576.$(OBJEXT) $(am__objects_184) +am__objects_185 = lib576-first.$(OBJEXT) +am_lib576_OBJECTS = lib576-lib576.$(OBJEXT) $(am__objects_185) lib576_OBJECTS = $(am_lib576_OBJECTS) lib576_LDADD = $(LDADD) lib576_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_185 = lib578-first.$(OBJEXT) -am_lib578_OBJECTS = lib578-lib578.$(OBJEXT) $(am__objects_185) +am__objects_186 = lib578-first.$(OBJEXT) +am_lib578_OBJECTS = lib578-lib578.$(OBJEXT) $(am__objects_186) lib578_OBJECTS = $(am_lib578_OBJECTS) lib578_LDADD = $(LDADD) lib578_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_186 = lib579-first.$(OBJEXT) -am_lib579_OBJECTS = lib579-lib579.$(OBJEXT) $(am__objects_186) +am__objects_187 = lib579-first.$(OBJEXT) +am_lib579_OBJECTS = lib579-lib579.$(OBJEXT) $(am__objects_187) lib579_OBJECTS = $(am_lib579_OBJECTS) lib579_LDADD = $(LDADD) lib579_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_187 = lib582-first.$(OBJEXT) -am__objects_188 = lib582-testutil.$(OBJEXT) -am__objects_189 = ../../lib/lib582-warnless.$(OBJEXT) -am_lib582_OBJECTS = lib582-lib582.$(OBJEXT) $(am__objects_187) \ - $(am__objects_188) $(am__objects_189) +am__objects_188 = lib582-first.$(OBJEXT) +am__objects_189 = lib582-testutil.$(OBJEXT) +am__objects_190 = ../../lib/lib582-warnless.$(OBJEXT) +am_lib582_OBJECTS = lib582-lib582.$(OBJEXT) $(am__objects_188) \ + $(am__objects_189) $(am__objects_190) lib582_OBJECTS = $(am_lib582_OBJECTS) lib582_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_190 = lib583-first.$(OBJEXT) -am_lib583_OBJECTS = lib583-lib583.$(OBJEXT) $(am__objects_190) +am__objects_191 = lib583-first.$(OBJEXT) +am_lib583_OBJECTS = lib583-lib583.$(OBJEXT) $(am__objects_191) lib583_OBJECTS = $(am_lib583_OBJECTS) lib583_LDADD = $(LDADD) lib583_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_191 = lib585-first.$(OBJEXT) -am__objects_192 = lib585-testutil.$(OBJEXT) -am__objects_193 = lib585-testtrace.$(OBJEXT) -am_lib585_OBJECTS = lib585-lib500.$(OBJEXT) $(am__objects_191) \ - $(am__objects_192) $(am__objects_193) +am__objects_192 = lib585-first.$(OBJEXT) +am__objects_193 = lib585-testutil.$(OBJEXT) +am__objects_194 = lib585-testtrace.$(OBJEXT) +am_lib585_OBJECTS = lib585-lib500.$(OBJEXT) $(am__objects_192) \ + $(am__objects_193) $(am__objects_194) lib585_OBJECTS = $(am_lib585_OBJECTS) lib585_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_194 = lib586-first.$(OBJEXT) -am_lib586_OBJECTS = lib586-lib586.$(OBJEXT) $(am__objects_194) +am__objects_195 = lib586-first.$(OBJEXT) +am_lib586_OBJECTS = lib586-lib586.$(OBJEXT) $(am__objects_195) lib586_OBJECTS = $(am_lib586_OBJECTS) lib586_LDADD = $(LDADD) lib586_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_195 = lib587-first.$(OBJEXT) -am_lib587_OBJECTS = lib587-lib554.$(OBJEXT) $(am__objects_195) +am__objects_196 = lib587-first.$(OBJEXT) +am_lib587_OBJECTS = lib587-lib554.$(OBJEXT) $(am__objects_196) lib587_OBJECTS = $(am_lib587_OBJECTS) lib587_LDADD = $(LDADD) lib587_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_196 = lib590-first.$(OBJEXT) -am_lib590_OBJECTS = lib590-lib590.$(OBJEXT) $(am__objects_196) +am__objects_197 = lib590-first.$(OBJEXT) +am_lib590_OBJECTS = lib590-lib590.$(OBJEXT) $(am__objects_197) lib590_OBJECTS = $(am_lib590_OBJECTS) lib590_LDADD = $(LDADD) lib590_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_197 = lib591-first.$(OBJEXT) -am__objects_198 = lib591-testutil.$(OBJEXT) -am__objects_199 = ../../lib/lib591-warnless.$(OBJEXT) -am_lib591_OBJECTS = lib591-lib591.$(OBJEXT) $(am__objects_197) \ - $(am__objects_198) $(am__objects_199) +am__objects_198 = lib591-first.$(OBJEXT) +am__objects_199 = lib591-testutil.$(OBJEXT) +am__objects_200 = ../../lib/lib591-warnless.$(OBJEXT) +am_lib591_OBJECTS = lib591-lib591.$(OBJEXT) $(am__objects_198) \ + $(am__objects_199) $(am__objects_200) lib591_OBJECTS = $(am_lib591_OBJECTS) lib591_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_200 = lib597-first.$(OBJEXT) -am__objects_201 = lib597-testutil.$(OBJEXT) -am__objects_202 = ../../lib/lib597-warnless.$(OBJEXT) -am_lib597_OBJECTS = lib597-lib597.$(OBJEXT) $(am__objects_200) \ - $(am__objects_201) $(am__objects_202) +am__objects_201 = lib597-first.$(OBJEXT) +am__objects_202 = lib597-testutil.$(OBJEXT) +am__objects_203 = ../../lib/lib597-warnless.$(OBJEXT) +am_lib597_OBJECTS = lib597-lib597.$(OBJEXT) $(am__objects_201) \ + $(am__objects_202) $(am__objects_203) lib597_OBJECTS = $(am_lib597_OBJECTS) lib597_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_203 = lib598-first.$(OBJEXT) -am_lib598_OBJECTS = lib598-lib598.$(OBJEXT) $(am__objects_203) +am__objects_204 = lib598-first.$(OBJEXT) +am_lib598_OBJECTS = lib598-lib598.$(OBJEXT) $(am__objects_204) lib598_OBJECTS = $(am_lib598_OBJECTS) lib598_LDADD = $(LDADD) lib598_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_204 = lib599-first.$(OBJEXT) -am_lib599_OBJECTS = lib599-lib599.$(OBJEXT) $(am__objects_204) +am__objects_205 = lib599-first.$(OBJEXT) +am_lib599_OBJECTS = lib599-lib599.$(OBJEXT) $(am__objects_205) lib599_OBJECTS = $(am_lib599_OBJECTS) lib599_LDADD = $(LDADD) lib599_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_205 = libauthretry-first.$(OBJEXT) +am__objects_206 = libauthretry-first.$(OBJEXT) am_libauthretry_OBJECTS = libauthretry-libauthretry.$(OBJEXT) \ - $(am__objects_205) + $(am__objects_206) libauthretry_OBJECTS = $(am_libauthretry_OBJECTS) libauthretry_LDADD = $(LDADD) libauthretry_DEPENDENCIES = $(am__DEPENDENCIES_1) -am__objects_206 = libntlmconnect-first.$(OBJEXT) -am__objects_207 = libntlmconnect-testutil.$(OBJEXT) -am__objects_208 = ../../lib/libntlmconnect-warnless.$(OBJEXT) +am__objects_207 = libntlmconnect-first.$(OBJEXT) +am__objects_208 = libntlmconnect-testutil.$(OBJEXT) +am__objects_209 = ../../lib/libntlmconnect-warnless.$(OBJEXT) am_libntlmconnect_OBJECTS = libntlmconnect-libntlmconnect.$(OBJEXT) \ - $(am__objects_206) $(am__objects_207) $(am__objects_208) + $(am__objects_207) $(am__objects_208) $(am__objects_209) libntlmconnect_OBJECTS = $(am_libntlmconnect_OBJECTS) libntlmconnect_DEPENDENCIES = $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) @@ -852,36 +857,36 @@ SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \ $(lib1506_SOURCES) $(lib1507_SOURCES) $(lib1508_SOURCES) \ $(lib1509_SOURCES) $(lib1510_SOURCES) $(lib1511_SOURCES) \ $(lib1512_SOURCES) $(lib1513_SOURCES) $(lib1514_SOURCES) \ - $(lib1515_SOURCES) $(lib1520_SOURCES) $(lib1525_SOURCES) \ - $(lib1526_SOURCES) $(lib1527_SOURCES) $(lib1528_SOURCES) \ - $(lib1529_SOURCES) $(lib1530_SOURCES) $(lib1531_SOURCES) \ - $(lib1900_SOURCES) $(lib2033_SOURCES) $(lib500_SOURCES) \ - $(lib501_SOURCES) $(lib502_SOURCES) $(lib503_SOURCES) \ - $(lib504_SOURCES) $(lib505_SOURCES) $(lib506_SOURCES) \ - $(lib507_SOURCES) $(lib508_SOURCES) $(lib509_SOURCES) \ - $(lib510_SOURCES) $(lib511_SOURCES) $(lib512_SOURCES) \ - $(lib513_SOURCES) $(lib514_SOURCES) $(lib515_SOURCES) \ - $(lib516_SOURCES) $(lib517_SOURCES) $(lib518_SOURCES) \ - $(lib519_SOURCES) $(lib520_SOURCES) $(lib521_SOURCES) \ - $(lib523_SOURCES) $(lib524_SOURCES) $(lib525_SOURCES) \ - $(lib526_SOURCES) $(lib527_SOURCES) $(lib529_SOURCES) \ - $(lib530_SOURCES) $(lib532_SOURCES) $(lib533_SOURCES) \ - $(lib536_SOURCES) $(lib537_SOURCES) $(lib539_SOURCES) \ - $(lib540_SOURCES) $(lib541_SOURCES) $(lib542_SOURCES) \ - $(lib543_SOURCES) $(lib544_SOURCES) $(lib545_SOURCES) \ - $(lib547_SOURCES) $(lib548_SOURCES) $(lib549_SOURCES) \ - $(lib552_SOURCES) $(lib553_SOURCES) $(lib554_SOURCES) \ - $(lib555_SOURCES) $(lib556_SOURCES) $(lib557_SOURCES) \ - $(lib558_SOURCES) $(lib560_SOURCES) $(lib562_SOURCES) \ - $(lib564_SOURCES) $(lib565_SOURCES) $(lib566_SOURCES) \ - $(lib567_SOURCES) $(lib568_SOURCES) $(lib569_SOURCES) \ - $(lib570_SOURCES) $(lib571_SOURCES) $(lib572_SOURCES) \ - $(lib573_SOURCES) $(lib574_SOURCES) $(lib575_SOURCES) \ - $(lib576_SOURCES) $(lib578_SOURCES) $(lib579_SOURCES) \ - $(lib582_SOURCES) $(lib583_SOURCES) $(lib585_SOURCES) \ - $(lib586_SOURCES) $(lib587_SOURCES) $(lib590_SOURCES) \ - $(lib591_SOURCES) $(lib597_SOURCES) $(lib598_SOURCES) \ - $(lib599_SOURCES) $(libauthretry_SOURCES) \ + $(lib1515_SOURCES) $(lib1517_SOURCES) $(lib1520_SOURCES) \ + $(lib1525_SOURCES) $(lib1526_SOURCES) $(lib1527_SOURCES) \ + $(lib1528_SOURCES) $(lib1529_SOURCES) $(lib1530_SOURCES) \ + $(lib1531_SOURCES) $(lib1900_SOURCES) $(lib2033_SOURCES) \ + $(lib500_SOURCES) $(lib501_SOURCES) $(lib502_SOURCES) \ + $(lib503_SOURCES) $(lib504_SOURCES) $(lib505_SOURCES) \ + $(lib506_SOURCES) $(lib507_SOURCES) $(lib508_SOURCES) \ + $(lib509_SOURCES) $(lib510_SOURCES) $(lib511_SOURCES) \ + $(lib512_SOURCES) $(lib513_SOURCES) $(lib514_SOURCES) \ + $(lib515_SOURCES) $(lib516_SOURCES) $(lib517_SOURCES) \ + $(lib518_SOURCES) $(lib519_SOURCES) $(lib520_SOURCES) \ + $(lib521_SOURCES) $(lib523_SOURCES) $(lib524_SOURCES) \ + $(lib525_SOURCES) $(lib526_SOURCES) $(lib527_SOURCES) \ + $(lib529_SOURCES) $(lib530_SOURCES) $(lib532_SOURCES) \ + $(lib533_SOURCES) $(lib536_SOURCES) $(lib537_SOURCES) \ + $(lib539_SOURCES) $(lib540_SOURCES) $(lib541_SOURCES) \ + $(lib542_SOURCES) $(lib543_SOURCES) $(lib544_SOURCES) \ + $(lib545_SOURCES) $(lib547_SOURCES) $(lib548_SOURCES) \ + $(lib549_SOURCES) $(lib552_SOURCES) $(lib553_SOURCES) \ + $(lib554_SOURCES) $(lib555_SOURCES) $(lib556_SOURCES) \ + $(lib557_SOURCES) $(lib558_SOURCES) $(lib560_SOURCES) \ + $(lib562_SOURCES) $(lib564_SOURCES) $(lib565_SOURCES) \ + $(lib566_SOURCES) $(lib567_SOURCES) $(lib568_SOURCES) \ + $(lib569_SOURCES) $(lib570_SOURCES) $(lib571_SOURCES) \ + $(lib572_SOURCES) $(lib573_SOURCES) $(lib574_SOURCES) \ + $(lib575_SOURCES) $(lib576_SOURCES) $(lib578_SOURCES) \ + $(lib579_SOURCES) $(lib582_SOURCES) $(lib583_SOURCES) \ + $(lib585_SOURCES) $(lib586_SOURCES) $(lib587_SOURCES) \ + $(lib590_SOURCES) $(lib591_SOURCES) $(lib597_SOURCES) \ + $(lib598_SOURCES) $(lib599_SOURCES) $(libauthretry_SOURCES) \ $(libntlmconnect_SOURCES) DIST_SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \ $(lib1500_SOURCES) $(lib1501_SOURCES) $(lib1502_SOURCES) \ @@ -889,36 +894,36 @@ DIST_SOURCES = $(libhostname_la_SOURCES) $(chkhostname_SOURCES) \ $(lib1506_SOURCES) $(lib1507_SOURCES) $(lib1508_SOURCES) \ $(lib1509_SOURCES) $(lib1510_SOURCES) $(lib1511_SOURCES) \ $(lib1512_SOURCES) $(lib1513_SOURCES) $(lib1514_SOURCES) \ - $(lib1515_SOURCES) $(lib1520_SOURCES) $(lib1525_SOURCES) \ - $(lib1526_SOURCES) $(lib1527_SOURCES) $(lib1528_SOURCES) \ - $(lib1529_SOURCES) $(lib1530_SOURCES) $(lib1531_SOURCES) \ - $(lib1900_SOURCES) $(lib2033_SOURCES) $(lib500_SOURCES) \ - $(lib501_SOURCES) $(lib502_SOURCES) $(lib503_SOURCES) \ - $(lib504_SOURCES) $(lib505_SOURCES) $(lib506_SOURCES) \ - $(lib507_SOURCES) $(lib508_SOURCES) $(lib509_SOURCES) \ - $(lib510_SOURCES) $(lib511_SOURCES) $(lib512_SOURCES) \ - $(lib513_SOURCES) $(lib514_SOURCES) $(lib515_SOURCES) \ - $(lib516_SOURCES) $(lib517_SOURCES) $(lib518_SOURCES) \ - $(lib519_SOURCES) $(lib520_SOURCES) $(lib521_SOURCES) \ - $(lib523_SOURCES) $(lib524_SOURCES) $(lib525_SOURCES) \ - $(lib526_SOURCES) $(lib527_SOURCES) $(lib529_SOURCES) \ - $(lib530_SOURCES) $(lib532_SOURCES) $(lib533_SOURCES) \ - $(lib536_SOURCES) $(lib537_SOURCES) $(lib539_SOURCES) \ - $(lib540_SOURCES) $(lib541_SOURCES) $(lib542_SOURCES) \ - $(lib543_SOURCES) $(lib544_SOURCES) $(lib545_SOURCES) \ - $(lib547_SOURCES) $(lib548_SOURCES) $(lib549_SOURCES) \ - $(lib552_SOURCES) $(lib553_SOURCES) $(lib554_SOURCES) \ - $(lib555_SOURCES) $(lib556_SOURCES) $(lib557_SOURCES) \ - $(lib558_SOURCES) $(lib560_SOURCES) $(lib562_SOURCES) \ - $(lib564_SOURCES) $(lib565_SOURCES) $(lib566_SOURCES) \ - $(lib567_SOURCES) $(lib568_SOURCES) $(lib569_SOURCES) \ - $(lib570_SOURCES) $(lib571_SOURCES) $(lib572_SOURCES) \ - $(lib573_SOURCES) $(lib574_SOURCES) $(lib575_SOURCES) \ - $(lib576_SOURCES) $(lib578_SOURCES) $(lib579_SOURCES) \ - $(lib582_SOURCES) $(lib583_SOURCES) $(lib585_SOURCES) \ - $(lib586_SOURCES) $(lib587_SOURCES) $(lib590_SOURCES) \ - $(lib591_SOURCES) $(lib597_SOURCES) $(lib598_SOURCES) \ - $(lib599_SOURCES) $(libauthretry_SOURCES) \ + $(lib1515_SOURCES) $(lib1517_SOURCES) $(lib1520_SOURCES) \ + $(lib1525_SOURCES) $(lib1526_SOURCES) $(lib1527_SOURCES) \ + $(lib1528_SOURCES) $(lib1529_SOURCES) $(lib1530_SOURCES) \ + $(lib1531_SOURCES) $(lib1900_SOURCES) $(lib2033_SOURCES) \ + $(lib500_SOURCES) $(lib501_SOURCES) $(lib502_SOURCES) \ + $(lib503_SOURCES) $(lib504_SOURCES) $(lib505_SOURCES) \ + $(lib506_SOURCES) $(lib507_SOURCES) $(lib508_SOURCES) \ + $(lib509_SOURCES) $(lib510_SOURCES) $(lib511_SOURCES) \ + $(lib512_SOURCES) $(lib513_SOURCES) $(lib514_SOURCES) \ + $(lib515_SOURCES) $(lib516_SOURCES) $(lib517_SOURCES) \ + $(lib518_SOURCES) $(lib519_SOURCES) $(lib520_SOURCES) \ + $(lib521_SOURCES) $(lib523_SOURCES) $(lib524_SOURCES) \ + $(lib525_SOURCES) $(lib526_SOURCES) $(lib527_SOURCES) \ + $(lib529_SOURCES) $(lib530_SOURCES) $(lib532_SOURCES) \ + $(lib533_SOURCES) $(lib536_SOURCES) $(lib537_SOURCES) \ + $(lib539_SOURCES) $(lib540_SOURCES) $(lib541_SOURCES) \ + $(lib542_SOURCES) $(lib543_SOURCES) $(lib544_SOURCES) \ + $(lib545_SOURCES) $(lib547_SOURCES) $(lib548_SOURCES) \ + $(lib549_SOURCES) $(lib552_SOURCES) $(lib553_SOURCES) \ + $(lib554_SOURCES) $(lib555_SOURCES) $(lib556_SOURCES) \ + $(lib557_SOURCES) $(lib558_SOURCES) $(lib560_SOURCES) \ + $(lib562_SOURCES) $(lib564_SOURCES) $(lib565_SOURCES) \ + $(lib566_SOURCES) $(lib567_SOURCES) $(lib568_SOURCES) \ + $(lib569_SOURCES) $(lib570_SOURCES) $(lib571_SOURCES) \ + $(lib572_SOURCES) $(lib573_SOURCES) $(lib574_SOURCES) \ + $(lib575_SOURCES) $(lib576_SOURCES) $(lib578_SOURCES) \ + $(lib579_SOURCES) $(lib582_SOURCES) $(lib583_SOURCES) \ + $(lib585_SOURCES) $(lib586_SOURCES) $(lib587_SOURCES) \ + $(lib590_SOURCES) $(lib591_SOURCES) $(lib597_SOURCES) \ + $(lib598_SOURCES) $(lib599_SOURCES) $(libauthretry_SOURCES) \ $(libntlmconnect_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -1147,7 +1152,7 @@ top_srcdir = @top_srcdir@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -1444,6 +1449,8 @@ lib1514_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1514 lib1515_SOURCES = lib1515.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1515_LDADD = $(TESTUTIL_LIBS) lib1515_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1515 +lib1517_SOURCES = lib1517.c $(SUPPORTFILES) +lib1517_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1517 lib1520_SOURCES = lib1520.c $(SUPPORTFILES) lib1520_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1520 lib1525_SOURCES = lib1525.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) @@ -1657,6 +1664,10 @@ lib1515$(EXEEXT): $(lib1515_OBJECTS) $(lib1515_DEPENDENCIES) $(EXTRA_lib1515_DEP @rm -f lib1515$(EXEEXT) $(AM_V_CCLD)$(LINK) $(lib1515_OBJECTS) $(lib1515_LDADD) $(LIBS) +lib1517$(EXEEXT): $(lib1517_OBJECTS) $(lib1517_DEPENDENCIES) $(EXTRA_lib1517_DEPENDENCIES) + @rm -f lib1517$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(lib1517_OBJECTS) $(lib1517_LDADD) $(LIBS) + lib1520$(EXEEXT): $(lib1520_OBJECTS) $(lib1520_DEPENDENCIES) $(EXTRA_lib1520_DEPENDENCIES) @rm -f lib1520$(EXEEXT) $(AM_V_CCLD)$(LINK) $(lib1520_OBJECTS) $(lib1520_LDADD) $(LIBS) @@ -2193,6 +2204,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1515-first.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1515-lib1515.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1515-testutil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1517-first.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1517-lib1517.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1520-first.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1520-lib1520.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lib1525-first.Po@am__quote@ @@ -3350,6 +3363,34 @@ lib1515-testutil.obj: testutil.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1515_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ../../lib/lib1515-warnless.obj `if test -f '../../lib/warnless.c'; then $(CYGPATH_W) '../../lib/warnless.c'; else $(CYGPATH_W) '$(srcdir)/../../lib/warnless.c'; fi` +lib1517-lib1517.o: lib1517.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1517-lib1517.o -MD -MP -MF $(DEPDIR)/lib1517-lib1517.Tpo -c -o lib1517-lib1517.o `test -f 'lib1517.c' || echo '$(srcdir)/'`lib1517.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib1517-lib1517.Tpo $(DEPDIR)/lib1517-lib1517.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lib1517.c' object='lib1517-lib1517.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1517-lib1517.o `test -f 'lib1517.c' || echo '$(srcdir)/'`lib1517.c + +lib1517-lib1517.obj: lib1517.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1517-lib1517.obj -MD -MP -MF $(DEPDIR)/lib1517-lib1517.Tpo -c -o lib1517-lib1517.obj `if test -f 'lib1517.c'; then $(CYGPATH_W) 'lib1517.c'; else $(CYGPATH_W) '$(srcdir)/lib1517.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib1517-lib1517.Tpo $(DEPDIR)/lib1517-lib1517.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='lib1517.c' object='lib1517-lib1517.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1517-lib1517.obj `if test -f 'lib1517.c'; then $(CYGPATH_W) 'lib1517.c'; else $(CYGPATH_W) '$(srcdir)/lib1517.c'; fi` + +lib1517-first.o: first.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1517-first.o -MD -MP -MF $(DEPDIR)/lib1517-first.Tpo -c -o lib1517-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib1517-first.Tpo $(DEPDIR)/lib1517-first.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='first.c' object='lib1517-first.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1517-first.o `test -f 'first.c' || echo '$(srcdir)/'`first.c + +lib1517-first.obj: first.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1517-first.obj -MD -MP -MF $(DEPDIR)/lib1517-first.Tpo -c -o lib1517-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib1517-first.Tpo $(DEPDIR)/lib1517-first.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='first.c' object='lib1517-first.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1517_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib1517-first.obj `if test -f 'first.c'; then $(CYGPATH_W) 'first.c'; else $(CYGPATH_W) '$(srcdir)/first.c'; fi` + lib1520-lib1520.o: lib1520.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib1520_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lib1520-lib1520.o -MD -MP -MF $(DEPDIR)/lib1520-lib1520.Tpo -c -o lib1520-lib1520.o `test -f 'lib1520.c' || echo '$(srcdir)/'`lib1520.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/lib1520-lib1520.Tpo $(DEPDIR)/lib1520-lib1520.Po @@ -7064,6 +7105,9 @@ uninstall-am: .PRECIOUS: Makefile +checksrc: + @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index 27d5ee98c..7ae66d797 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -21,7 +21,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \ lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 lib582 \ lib583 lib585 lib586 lib587 lib590 lib591 lib597 lib598 lib599 \ lib1500 lib1501 lib1502 lib1503 lib1504 lib1505 lib1506 lib1507 lib1508 \ - lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 \ + lib1509 lib1510 lib1511 lib1512 lib1513 lib1514 lib1515 lib1517 \ lib1520 \ lib1525 lib1526 lib1527 lib1528 lib1529 lib1530 lib1531 \ lib1900 \ @@ -357,6 +357,9 @@ lib1515_SOURCES = lib1515.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib1515_LDADD = $(TESTUTIL_LIBS) lib1515_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1515 +lib1517_SOURCES = lib1517.c $(SUPPORTFILES) +lib1517_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1517 + lib1520_SOURCES = lib1520.c $(SUPPORTFILES) lib1520_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1520 diff --git a/tests/libtest/chkhostname.c b/tests/libtest/chkhostname.c index 02a4eefaa..79e382b38 100644 --- a/tests/libtest/chkhostname.c +++ b/tests/libtest/chkhostname.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int main(int argc, char *argv[]) { char buff[HOSTNAME_MAX]; - if (argc != 2) { + if(argc != 2) { printf("Usage: %s EXPECTED_HOSTNAME\n", argv[0]); return 1; } - if (Curl_gethostname(buff, HOSTNAME_MAX)) { + if(Curl_gethostname(buff, HOSTNAME_MAX)) { printf("Curl_gethostname() failed\n"); return 1; } diff --git a/tests/libtest/first.c b/tests/libtest/first.c index 4714395ea..231ae368c 100644 --- a/tests/libtest/first.c +++ b/tests/libtest/first.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -69,7 +69,7 @@ void wait_ms(int ms) t.tv_sec = ms/1000; ms -= (int)t.tv_sec * 1000; t.tv_usec = ms * 1000; - select_wrapper(0, NULL, NULL , NULL, &t); + select_wrapper(0, NULL, NULL, NULL, &t); } char *libtest_arg2=NULL; @@ -153,7 +153,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); #endif - if(argc< 2 ) { + if(argc< 2) { fprintf(stderr, "Pass URL as argument please\n"); return 1; } diff --git a/tests/libtest/lib1500.c b/tests/libtest/lib1500.c index 89983613d..f3c495869 100644 --- a/tests/libtest/lib1500.c +++ b/tests/libtest/lib1500.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -56,7 +56,7 @@ int test(char *URL) while(still_running) { int num; res = curl_multi_wait(multi, NULL, 0, TEST_HANG_TIMEOUT, &num); - if (res != CURLM_OK) { + if(res != CURLM_OK) { printf("curl_multi_wait() returned %d\n", res); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; diff --git a/tests/libtest/lib1501.c b/tests/libtest/lib1501.c index f9bd9663b..cc442b529 100644 --- a/tests/libtest/lib1501.c +++ b/tests/libtest/lib1501.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -41,7 +41,7 @@ static int elapsed(struct timeval *before, result = (after->tv_sec - before->tv_sec) * 1000000 + after->tv_usec - before->tv_usec; - if (result < 0) + if(result < 0) result = 0; return curlx_sztosi(result); diff --git a/tests/libtest/lib1502.c b/tests/libtest/lib1502.c index 2336a8d3a..e4e1a162a 100644 --- a/tests/libtest/lib1502.c +++ b/tests/libtest/lib1502.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -51,7 +51,8 @@ int test(char *URL) /* DNS cache injection */ struct curl_slist *dns_cache_list; - sprintf(redirect, "google.com:%s:%s", libtest_arg2, libtest_arg3); + snprintf(redirect, sizeof(redirect), "google.com:%s:%s", libtest_arg2, + libtest_arg3); start_test_timing(); diff --git a/tests/libtest/lib1506.c b/tests/libtest/lib1506.c index 0551f04b7..47fc335ce 100644 --- a/tests/libtest/lib1506.c +++ b/tests/libtest/lib1506.c @@ -46,7 +46,8 @@ int test(char *URL) /* Create fake DNS entries for serverX.example.com for all handles */ for(i=0; i < NUM_HANDLES; i++) { - sprintf(dnsentry, "server%d.example.com:%s:%s", i + 1, port, address); + snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", + i + 1, port, address); printf("%s\n", dnsentry); slist2 = curl_slist_append(slist, dnsentry); if(!slist2) { @@ -69,8 +70,9 @@ int test(char *URL) /* get an easy handle */ easy_init(curl[i]); /* specify target */ - sprintf(target_url, "http://server%d.example.com:%s/path/1506%04i", - i + 1, port, i + 1); + snprintf(target_url, sizeof(target_url), + "http://server%d.example.com:%s/path/1506%04i", + i + 1, port, i + 1); target_url[sizeof(target_url) - 1] = '\0'; easy_setopt(curl[i], CURLOPT_URL, target_url); /* go verbose */ diff --git a/tests/libtest/lib1507.c b/tests/libtest/lib1507.c index 5340c57a9..5a7994ebd 100644 --- a/tests/libtest/lib1507.c +++ b/tests/libtest/lib1507.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -137,7 +137,7 @@ int test(char *URL) rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout); - if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { + if(tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) { fprintf(stderr, "ABORTING TEST, since it seems " "that it would have run forever.\n"); break; diff --git a/tests/libtest/lib1510.c b/tests/libtest/lib1510.c index 3d791e01e..25e9fed31 100644 --- a/tests/libtest/lib1510.c +++ b/tests/libtest/lib1510.c @@ -44,7 +44,8 @@ int test(char *URL) /* Create fake DNS entries for serverX.example.com for all handles */ for(i=0; i < NUM_URLS; i++) { - sprintf(dnsentry, "server%d.example.com:%s:%s", i + 1, port, address); + snprintf(dnsentry, sizeof(dnsentry), "server%d.example.com:%s:%s", i + 1, + port, address); printf("%s\n", dnsentry); slist2 = curl_slist_append(slist, dnsentry); if(!slist2) { @@ -73,8 +74,9 @@ int test(char *URL) /* get NUM_HANDLES easy handles */ for(i=0; i < NUM_URLS; i++) { /* specify target */ - sprintf(target_url, "http://server%d.example.com:%s/path/1510%04i", - i + 1, port, i + 1); + snprintf(target_url, sizeof(target_url), + "http://server%d.example.com:%s/path/1510%04i", + i + 1, port, i + 1); target_url[sizeof(target_url) - 1] = '\0'; easy_setopt(curl, CURLOPT_URL, target_url); diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c index 759898737..f4091b45a 100644 --- a/tests/libtest/lib1512.c +++ b/tests/libtest/lib1512.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013, Linus Nielsen Feltzing <linus@haxx.se> + * Copyright (C) 2013 - 2016, Linus Nielsen Feltzing <linus@haxx.se> * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -49,7 +49,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - sprintf(dnsentry, "server.example.curl:%s:%s", port, address); + snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s", + port, address); printf("%s\n", dnsentry); slist = curl_slist_append(slist, dnsentry); @@ -58,8 +59,9 @@ int test(char *URL) /* get an easy handle */ easy_init(curl[i]); /* specify target */ - sprintf(target_url, "http://server.example.curl:%s/path/1512%04i", - port, i + 1); + snprintf(target_url, sizeof(target_url), + "http://server.example.curl:%s/path/1512%04i", + port, i + 1); target_url[sizeof(target_url) - 1] = '\0'; easy_setopt(curl[i], CURLOPT_URL, target_url); /* go verbose */ diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c index db0d09ed6..2fd19bb7b 100644 --- a/tests/libtest/lib1515.c +++ b/tests/libtest/lib1515.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -39,7 +39,8 @@ #define sleep(s) Sleep(s * 1000) #endif -static int debug_callback(CURL *curl, curl_infotype info, char *msg, size_t len, void *ptr) +static int debug_callback(CURL *curl, curl_infotype info, char *msg, + size_t len, void *ptr) { (void)curl; (void)ptr; @@ -121,7 +122,8 @@ int test(char *URL) int i; int count = 2; - snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s", port, address); + snprintf(dns_entry, sizeof(dns_entry), "testserver.example.com:%s:%s", + port, address); start_test_timing(); @@ -130,7 +132,8 @@ int test(char *URL) for(i = 1; i <= count; i++) { char target_url[256]; - snprintf(target_url, sizeof(target_url), "http://testserver.example.com:%s/%s%04d", port, path, i); + snprintf(target_url, sizeof(target_url), + "http://testserver.example.com:%s/%s%04d", port, path, i); /* second request must succeed like the first one */ if((res = do_one_request(multi, target_url, dns_entry))) diff --git a/tests/libtest/lib1517.c b/tests/libtest/lib1517.c new file mode 100644 index 000000000..e270ed74d --- /dev/null +++ b/tests/libtest/lib1517.c @@ -0,0 +1,116 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "test.h" + +#include "memdebug.h" + +static char data[]="this is what we post to the silly web server\n"; + +struct WriteThis { + char *readptr; + size_t sizeleft; +}; + +static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp) +{ + struct WriteThis *pooh = (struct WriteThis *)userp; + size_t tocopy = size * nmemb; + + /* Wait one second before return POST data * + * so libcurl will wait before sending request body */ + wait_ms(1000); + + if(tocopy < 1 || !pooh->sizeleft) + return 0; + + if(pooh->sizeleft < tocopy) + tocopy = pooh->sizeleft; + + memcpy(ptr, pooh->readptr, tocopy);/* copy requested data */ + pooh->readptr += tocopy; /* advance pointer */ + pooh->sizeleft -= tocopy; /* less data left */ + return tocopy; +} + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + struct WriteThis pooh; + + pooh.readptr = data; + pooh.sizeleft = strlen(data); + + if(curl_global_init(CURL_GLOBAL_ALL)) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + curl = curl_easy_init(); + if(!curl) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + /* First set the URL that is about to receive our POST. */ + test_setopt(curl, CURLOPT_URL, URL); + + /* Now specify we want to POST data */ + test_setopt(curl, CURLOPT_POST, 1L); + +#ifdef CURL_DOES_CONVERSIONS + /* Convert the POST data to ASCII */ + test_setopt(curl, CURLOPT_TRANSFERTEXT, 1L); +#endif + + /* Set the expected POST size */ + test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)pooh.sizeleft); + + /* we want to use our own read function */ + test_setopt(curl, CURLOPT_READFUNCTION, read_callback); + + /* pointer to pass to our read function */ + test_setopt(curl, CURLOPT_READDATA, &pooh); + + /* get verbose debug output please */ + test_setopt(curl, CURLOPT_VERBOSE, 1L); + + /* include headers in the output */ + test_setopt(curl, CURLOPT_HEADER, 1L); + + /* detect HTTP error codes >= 400 */ + /* test_setopt(curl, CURLOPT_FAILONERROR, 1L); */ + + + /* Perform the request, res will get the return code */ + res = curl_easy_perform(curl); + +test_cleanup: + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return res; +} diff --git a/tests/libtest/lib1525.c b/tests/libtest/lib1525.c index 270a002b5..c58ebeda9 100644 --- a/tests/libtest/lib1525.c +++ b/tests/libtest/lib1525.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al. * * This software is licensed as described in the file COPYING, which @@ -35,7 +35,7 @@ static char data [] = "Hello Cloud!\n"; static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t amount = nmemb * size; /* Total bytes curl wants */ - if (amount < strlen(data)) { + if(amount < strlen(data)) { return strlen(data); } (void)stream; @@ -64,7 +64,7 @@ int test(char *URL) hhl = curl_slist_append(hhl, "User-Agent: Http Agent"); - if (!hhl) { + if(!hhl) { goto test_cleanup; } diff --git a/tests/libtest/lib1526.c b/tests/libtest/lib1526.c index 0ebd8edad..ef66a484d 100644 --- a/tests/libtest/lib1526.c +++ b/tests/libtest/lib1526.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al. + * Copyright (C) 1998 - 2016, Vijay Panghal, <vpanghal@maginatics.com>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -34,7 +34,7 @@ static char data [] = "Hello Cloud!\n"; static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t amount = nmemb * size; /* Total bytes curl wants */ - if (amount < strlen(data)) { + if(amount < strlen(data)) { return strlen(data); } (void)stream; @@ -62,11 +62,11 @@ int test(char *URL) hhl = curl_slist_append(hhl, "User-Agent: Http Agent"); phl = curl_slist_append(phl, "User-Agent: Proxy Agent"); - if (!hhl || !phl) { + if(!hhl || !phl) { goto test_cleanup; } tmp = curl_slist_append(phl, "Expect:"); - if (!tmp) { + if(!tmp) { goto test_cleanup; } phl = tmp; diff --git a/tests/libtest/lib1527.c b/tests/libtest/lib1527.c index e3ba10613..f008cf1e4 100644 --- a/tests/libtest/lib1527.c +++ b/tests/libtest/lib1527.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Vijay Panghal, <vpanghal@maginatics.com>, et al. + * Copyright (C) 1998 - 2016, Vijay Panghal, <vpanghal@maginatics.com>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -34,7 +34,7 @@ static char data [] = "Hello Cloud!\n"; static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t amount = nmemb * size; /* Total bytes curl wants */ - if (amount < strlen(data)) { + if(amount < strlen(data)) { return strlen(data); } (void)stream; @@ -62,11 +62,11 @@ int test(char *URL) } hhl = curl_slist_append(hhl, "User-Agent: Http Agent"); - if (!hhl) { + if(!hhl) { goto test_cleanup; } tmp = curl_slist_append(hhl, "Expect: 100-continue"); - if (!tmp) { + if(!tmp) { goto test_cleanup; } hhl = tmp; diff --git a/tests/libtest/lib1528.c b/tests/libtest/lib1528.c index cd953d6f5..09af481f4 100644 --- a/tests/libtest/lib1528.c +++ b/tests/libtest/lib1528.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -46,7 +46,7 @@ int test(char *URL) hhl = curl_slist_append(hhl, "User-Agent: Http Agent"); phl = curl_slist_append(phl, "Proxy-User-Agent: Http Agent2"); - if (!hhl) { + if(!hhl) { goto test_cleanup; } diff --git a/tests/libtest/lib1531.c b/tests/libtest/lib1531.c index 438408dfb..b21d06733 100644 --- a/tests/libtest/lib1531.c +++ b/tests/libtest/lib1531.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -49,7 +49,8 @@ int test(char *URL) /* set the options (I left out a few, you'll get the point anyway) */ curl_easy_setopt(easy, CURLOPT_URL, URL); - curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)testDataSize); + curl_easy_setopt(easy, CURLOPT_POSTFIELDSIZE_LARGE, + (curl_off_t)testDataSize); curl_easy_setopt(easy, CURLOPT_POSTFIELDS, testData); /* we start some action by calling perform right away */ @@ -87,8 +88,7 @@ int test(char *URL) /* get file descriptors from the transfers */ mc = curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd); - if(mc != CURLM_OK) - { + if(mc != CURLM_OK) { fprintf(stderr, "curl_multi_fdset() failed, code %d.\n", mc); break; } @@ -127,8 +127,8 @@ int test(char *URL) } while(still_running); /* See how the transfers went */ - while ((msg = curl_multi_info_read(multi_handle, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { + while((msg = curl_multi_info_read(multi_handle, &msgs_left))) { + if(msg->msg == CURLMSG_DONE) { printf("HTTP transfer completed with status %d\n", msg->data.result); break; } diff --git a/tests/libtest/lib1900.c b/tests/libtest/lib1900.c index f52a9c2d1..4502fc0d6 100644 --- a/tests/libtest/lib1900.c +++ b/tests/libtest/lib1900.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013, Linus Nielsen Feltzing, <linus@haxx.se> + * Copyright (C) 2013 - 2016, Linus Nielsen Feltzing, <linus@haxx.se> * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -113,7 +113,7 @@ static void setup_handle(char *base_url, CURLM *m, int handlenum) { char urlbuf[256]; - sprintf(urlbuf, "%s%s", base_url, urlstring[handlenum]); + snprintf(urlbuf, sizeof(urlbuf), "%s%s", base_url, urlstring[handlenum]); curl_easy_setopt(handles[handlenum], CURLOPT_URL, urlbuf); curl_easy_setopt(handles[handlenum], CURLOPT_VERBOSE, 1L); curl_easy_setopt(handles[handlenum], CURLOPT_FAILONERROR, 1L); @@ -192,12 +192,12 @@ int test(char *URL) abort_on_test_timeout(); /* See how the transfers went */ - while ((msg = curl_multi_info_read(m, &msgs_left))) { - if (msg->msg == CURLMSG_DONE) { + while((msg = curl_multi_info_read(m, &msgs_left))) { + if(msg->msg == CURLMSG_DONE) { int i, found = 0; /* Find out which handle this message is about */ - for (i = 0; i < num_handles; i++) { + for(i = 0; i < num_handles; i++) { found = (msg->easy_handle == handles[i]); if(found) break; diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c index e249d9f9d..43b05982c 100644 --- a/tests/libtest/lib500.c +++ b/tests/libtest/lib500.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -63,12 +63,12 @@ int test(char *URL) CURL *curl; char *ipstr=NULL; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -92,42 +92,42 @@ int test(char *URL) if(!res) { res = curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, &ipstr); - if (libtest_arg2) { + if(libtest_arg2) { FILE *moo = fopen(libtest_arg2, "wb"); if(moo) { - double time_namelookup; - double time_connect; - double time_pretransfer; - double time_starttransfer; - double time_total; - fprintf(moo, "IP: %s\n", ipstr); - curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup); - curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect); - curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer); - curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, - &time_starttransfer); - curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total); - - /* since the timing will always vary we only compare relative differences - between these 5 times */ - if(time_namelookup > time_connect) { - fprintf(moo, "namelookup vs connect: %f %f\n", - time_namelookup, time_connect); - } - if(time_connect > time_pretransfer) { - fprintf(moo, "connect vs pretransfer: %f %f\n", - time_connect, time_pretransfer); - } - if(time_pretransfer > time_starttransfer) { - fprintf(moo, "pretransfer vs starttransfer: %f %f\n", - time_pretransfer, time_starttransfer); - } - if(time_starttransfer > time_total) { - fprintf(moo, "starttransfer vs total: %f %f\n", - time_starttransfer, time_total); - } - - fclose(moo); + double time_namelookup; + double time_connect; + double time_pretransfer; + double time_starttransfer; + double time_total; + fprintf(moo, "IP: %s\n", ipstr); + curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME, &time_namelookup); + curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &time_connect); + curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME, &time_pretransfer); + curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME, + &time_starttransfer); + curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &time_total); + + /* since the timing will always vary we only compare relative + differences between these 5 times */ + if(time_namelookup > time_connect) { + fprintf(moo, "namelookup vs connect: %f %f\n", + time_namelookup, time_connect); + } + if(time_connect > time_pretransfer) { + fprintf(moo, "connect vs pretransfer: %f %f\n", + time_connect, time_pretransfer); + } + if(time_pretransfer > time_starttransfer) { + fprintf(moo, "pretransfer vs starttransfer: %f %f\n", + time_pretransfer, time_starttransfer); + } + if(time_starttransfer > time_total) { + fprintf(moo, "starttransfer vs total: %f %f\n", + time_starttransfer, time_total); + } + + fclose(moo); } } } diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c index b1b9ad413..2a105f0cd 100644 --- a/tests/libtest/lib501.c +++ b/tests/libtest/lib501.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -30,12 +30,12 @@ int test(char *URL) (void)URL; /* we don't use this */ - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c index 557342059..3466dc948 100644 --- a/tests/libtest/lib504.c +++ b/tests/libtest/lib504.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -50,7 +50,7 @@ int test(char *URL) /* The point here is that there must not be anything running on the given proxy port */ - if (libtest_arg2) + if(libtest_arg2) easy_setopt(c, CURLOPT_PROXY, libtest_arg2); easy_setopt(c, CURLOPT_URL, URL); easy_setopt(c, CURLOPT_VERBOSE, 1L); diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index 79c3bc79b..127fde77e 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -38,8 +38,8 @@ int test(char *URL) { CURL *curl; CURLcode res = CURLE_OK; - FILE *hd_src ; - int hd ; + FILE *hd_src; + int hd; struct_stat file_info; struct curl_slist *hl; int error; @@ -48,7 +48,7 @@ int test(char *URL) const char *buf_1 = "RNFR 505"; const char *buf_2 = "RNTO 505-forreal"; - if (!libtest_arg2) { + if(!libtest_arg2) { fprintf(stderr, "Usage: <url> <file-to-upload>\n"); return TEST_ERR_USAGE; } @@ -56,7 +56,7 @@ int test(char *URL) hd_src = fopen(libtest_arg2, "rb"); if(NULL == hd_src) { error = ERRNO; - fprintf(stderr, "fopen() failed with error: %d %s\n", + fprintf(stderr, "fopen failed with error: %d %s\n", error, strerror(error)); fprintf(stderr, "Error opening file: %s\n", libtest_arg2); return TEST_ERR_MAJOR_BAD; /* if this happens things are major weird */ @@ -80,14 +80,15 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); fclose(hd_src); return TEST_ERR_MAJOR_BAD; } /* get a curl handle */ - if ((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); fclose(hd_src); @@ -96,14 +97,16 @@ int test(char *URL) /* build a list of commands to pass to libcurl */ - if ((hl = curl_slist_append(headerlist, buf_1)) == NULL) { + hl = curl_slist_append(headerlist, buf_1); + if(!hl) { fprintf(stderr, "curl_slist_append() failed\n"); curl_easy_cleanup(curl); curl_global_cleanup(); fclose(hd_src); return TEST_ERR_MAJOR_BAD; } - if ((headerlist = curl_slist_append(hl, buf_2)) == NULL) { + headerlist = curl_slist_append(hl, buf_2); + if(!headerlist) { fprintf(stderr, "curl_slist_append() failed\n"); curl_slist_free_all(hl); curl_easy_cleanup(curl); @@ -120,7 +123,7 @@ int test(char *URL) test_setopt(curl, CURLOPT_VERBOSE, 1L); /* specify target */ - test_setopt(curl,CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_URL, URL); /* pass in that last of FTP commands to run after the transfer */ test_setopt(curl, CURLOPT_POSTQUOTE, headerlist); diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 4ee384f04..8de30c20b 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,8 +40,8 @@ struct userdata { int lock[3]; /* lock callback */ -static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, - void *useptr ) +static void my_lock(CURL *handle, curl_lock_data data, + curl_lock_access laccess, void *useptr) { const char *what; struct userdata *user = (struct userdata *)useptr; @@ -50,7 +50,7 @@ static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, (void)handle; (void)laccess; - switch ( data ) { + switch (data) { case CURL_LOCK_DATA_SHARE: what = "share"; locknum = 0; @@ -80,13 +80,13 @@ static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, } /* unlock callback */ -static void my_unlock(CURL *handle, curl_lock_data data, void *useptr ) +static void my_unlock(CURL *handle, curl_lock_data data, void *useptr) { const char *what; struct userdata *user = (struct userdata *)useptr; int locknum; (void)handle; - switch ( data ) { + switch (data) { case CURL_LOCK_DATA_SHARE: what = "share"; locknum = 0; @@ -120,7 +120,7 @@ static void my_unlock(CURL *handle, curl_lock_data data, void *useptr ) static struct curl_slist *sethost(struct curl_slist *headers) { (void)headers; - return curl_slist_append(NULL, HOSTHEADER ); + return curl_slist_append(NULL, HOSTHEADER); } @@ -133,7 +133,8 @@ static void *fire(void *ptr) CURL *curl; int i=0; - if ((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); return NULL; } @@ -142,17 +143,17 @@ static void *fire(void *ptr) curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_URL, tdata->url); - printf( "CURLOPT_SHARE\n" ); + printf("CURLOPT_SHARE\n"); curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share); - printf( "PERFORM\n" ); + printf("PERFORM\n"); code = curl_easy_perform(curl); - if( code != CURLE_OK ) { + if(code) { fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", tdata->url, i, (int)code); } - printf( "CLEANUP\n" ); + printf("CLEANUP\n"); curl_easy_cleanup(curl); curl_slist_free_all(headers); @@ -186,42 +187,42 @@ int test(char *URL) user.text = (char *)"Pigs in space"; user.counter = 0; - printf( "GLOBAL_INIT\n" ); - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + printf("GLOBAL_INIT\n"); + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } /* prepare share */ - printf( "SHARE_INIT\n" ); - if ((share = curl_share_init()) == NULL) { + printf("SHARE_INIT\n"); + if((share = curl_share_init()) == NULL) { fprintf(stderr, "curl_share_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } - if ( CURLSHE_OK == scode ) { - printf( "CURLSHOPT_LOCKFUNC\n" ); - scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, my_lock); + if(CURLSHE_OK == scode) { + printf("CURLSHOPT_LOCKFUNC\n"); + scode = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, my_lock); } - if ( CURLSHE_OK == scode ) { - printf( "CURLSHOPT_UNLOCKFUNC\n" ); - scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, my_unlock); + if(CURLSHE_OK == scode) { + printf("CURLSHOPT_UNLOCKFUNC\n"); + scode = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, my_unlock); } - if ( CURLSHE_OK == scode ) { - printf( "CURLSHOPT_USERDATA\n" ); - scode = curl_share_setopt( share, CURLSHOPT_USERDATA, &user); + if(CURLSHE_OK == scode) { + printf("CURLSHOPT_USERDATA\n"); + scode = curl_share_setopt(share, CURLSHOPT_USERDATA, &user); } - if ( CURLSHE_OK == scode ) { - printf( "CURL_LOCK_DATA_COOKIE\n" ); - scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); + if(CURLSHE_OK == scode) { + printf("CURL_LOCK_DATA_COOKIE\n"); + scode = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE); } - if ( CURLSHE_OK == scode ) { - printf( "CURL_LOCK_DATA_DNS\n" ); - scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); + if(CURLSHE_OK == scode) { + printf("CURL_LOCK_DATA_DNS\n"); + scode = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); } - if ( CURLSHE_OK != scode ) { + if(CURLSHE_OK != scode) { fprintf(stderr, "curl_share_setopt() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); @@ -229,149 +230,145 @@ int test(char *URL) } /* initial cookie manipulation */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } - printf( "CURLOPT_SHARE\n" ); - test_setopt( curl, CURLOPT_SHARE, share ); - printf( "CURLOPT_COOKIELIST injected_and_clobbered\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, + printf("CURLOPT_SHARE\n"); + test_setopt(curl, CURLOPT_SHARE, share); + printf("CURLOPT_COOKIELIST injected_and_clobbered\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "Set-Cookie: injected_and_clobbered=yes; " - "domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030" ); - printf( "CURLOPT_COOKIELIST ALL\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, "ALL" ); - printf( "CURLOPT_COOKIELIST session\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, "Set-Cookie: session=elephants" ); - printf( "CURLOPT_COOKIELIST injected\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, + "domain=host.foo.com; expires=Sat Feb 2 11:56:27 GMT 2030"); + printf("CURLOPT_COOKIELIST ALL\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "ALL"); + printf("CURLOPT_COOKIELIST session\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "Set-Cookie: session=elephants"); + printf("CURLOPT_COOKIELIST injected\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "Set-Cookie: injected=yes; domain=host.foo.com; " - "expires=Sat Feb 2 11:56:27 GMT 2030" ); - printf( "CURLOPT_COOKIELIST SESS\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, "SESS" ); - printf( "CLEANUP\n" ); - curl_easy_cleanup( curl ); + "expires=Sat Feb 2 11:56:27 GMT 2030"); + printf("CURLOPT_COOKIELIST SESS\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "SESS"); + printf("CLEANUP\n"); + curl_easy_cleanup(curl); res = 0; /* start treads */ - for (i=1; i<=THREADS; i++ ) { + for(i=1; i<=THREADS; i++) { /* set thread data */ - tdata.url = suburl( URL, i ); /* must be curl_free()d */ + tdata.url = suburl(URL, i); /* must be curl_free()d */ tdata.share = share; /* simulate thread, direct call of "thread" function */ - printf( "*** run %d\n",i ); - fire( &tdata ); - - curl_free( tdata.url ); + printf("*** run %d\n",i); + fire(&tdata); + curl_free(tdata.url); } /* fetch a another one and save cookies */ - printf( "*** run %d\n", i ); - if ((curl = curl_easy_init()) == NULL) { + printf("*** run %d\n", i); + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } - url = suburl( URL, i ); - headers = sethost( NULL ); - test_setopt( curl, CURLOPT_HTTPHEADER, headers ); - test_setopt( curl, CURLOPT_URL, url ); - printf( "CURLOPT_SHARE\n" ); - test_setopt( curl, CURLOPT_SHARE, share ); - printf( "CURLOPT_COOKIEJAR\n" ); - test_setopt( curl, CURLOPT_COOKIEJAR, JAR ); - printf( "CURLOPT_COOKIELIST FLUSH\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, "FLUSH" ); - - printf( "PERFORM\n" ); - curl_easy_perform( curl ); - - printf( "CLEANUP\n" ); - curl_easy_cleanup( curl ); + url = suburl(URL, i); + headers = sethost(NULL); + test_setopt(curl, CURLOPT_HTTPHEADER, headers); + test_setopt(curl, CURLOPT_URL, url); + printf("CURLOPT_SHARE\n"); + test_setopt(curl, CURLOPT_SHARE, share); + printf("CURLOPT_COOKIEJAR\n"); + test_setopt(curl, CURLOPT_COOKIEJAR, JAR); + printf("CURLOPT_COOKIELIST FLUSH\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "FLUSH"); + + printf("PERFORM\n"); + curl_easy_perform(curl); + + printf("CLEANUP\n"); + curl_easy_cleanup(curl); curl_free(url); - curl_slist_free_all( headers ); + curl_slist_free_all(headers); /* load cookies */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } - url = suburl( URL, i ); - headers = sethost( NULL ); - test_setopt( curl, CURLOPT_HTTPHEADER, headers ); - test_setopt( curl, CURLOPT_URL, url ); - printf( "CURLOPT_SHARE\n" ); - test_setopt( curl, CURLOPT_SHARE, share ); - printf( "CURLOPT_COOKIELIST ALL\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, "ALL" ); - printf( "CURLOPT_COOKIEJAR\n" ); - test_setopt( curl, CURLOPT_COOKIEFILE, JAR ); - printf( "CURLOPT_COOKIELIST RELOAD\n" ); - test_setopt( curl, CURLOPT_COOKIELIST, "RELOAD" ); + url = suburl(URL, i); + headers = sethost(NULL); + test_setopt(curl, CURLOPT_HTTPHEADER, headers); + test_setopt(curl, CURLOPT_URL, url); + printf("CURLOPT_SHARE\n"); + test_setopt(curl, CURLOPT_SHARE, share); + printf("CURLOPT_COOKIELIST ALL\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "ALL"); + printf("CURLOPT_COOKIEJAR\n"); + test_setopt(curl, CURLOPT_COOKIEFILE, JAR); + printf("CURLOPT_COOKIELIST RELOAD\n"); + test_setopt(curl, CURLOPT_COOKIELIST, "RELOAD"); code = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); - if ( code != CURLE_OK ) - { + if(code != CURLE_OK) { fprintf(stderr, "curl_easy_getinfo() failed\n"); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } printf("loaded cookies:\n"); - if ( !cookies ) - { + if(!cookies) { fprintf(stderr, " reloading cookies from '%s' failed\n", JAR); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } printf("-----------------\n"); next_cookie = cookies; - while ( next_cookie ) - { - printf( " %s\n", next_cookie->data ); + while(next_cookie) { + printf(" %s\n", next_cookie->data); next_cookie = next_cookie->next; } printf("-----------------\n"); - curl_slist_free_all( cookies ); + curl_slist_free_all(cookies); /* try to free share, expect to fail because share is in use*/ - printf( "try SHARE_CLEANUP...\n" ); - scode = curl_share_cleanup( share ); - if ( scode==CURLSHE_OK ) - { + printf("try SHARE_CLEANUP...\n"); + scode = curl_share_cleanup(share); + if(scode==CURLSHE_OK) { fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); share = NULL; - } else { - printf( "SHARE_CLEANUP failed, correct\n" ); + } + else { + printf("SHARE_CLEANUP failed, correct\n"); } test_cleanup: /* clean up last handle */ - printf( "CLEANUP\n" ); - curl_easy_cleanup( curl ); - curl_slist_free_all( headers ); + printf("CLEANUP\n"); + curl_easy_cleanup(curl); + curl_slist_free_all(headers); curl_free(url); /* free share */ - printf( "SHARE_CLEANUP\n" ); - scode = curl_share_cleanup( share ); - if ( scode!=CURLSHE_OK ) + printf("SHARE_CLEANUP\n"); + scode = curl_share_cleanup(share); + if(scode!=CURLSHE_OK) fprintf(stderr, "curl_share_cleanup failed, code errno %d\n", (int)scode); - printf( "GLOBAL_CLEANUP\n" ); + printf("GLOBAL_CLEANUP\n"); curl_global_cleanup(); return res; diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c index 5b2ff1f29..cb60ce1bd 100644 --- a/tests/libtest/lib508.c +++ b/tests/libtest/lib508.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -57,12 +57,12 @@ int test(char *URL) pooh.readptr = data; pooh.sizeleft = strlen(data); - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c index 1f9e3e499..085a9753e 100644 --- a/tests/libtest/lib509.c +++ b/tests/libtest/lib509.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -117,12 +117,12 @@ int test(char *URL) custom_realloc, custom_strdup, custom_calloc); - if (res != CURLE_OK) { + if(res != CURLE_OK) { fprintf(stderr, "curl_global_init_mem() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index f84af76c0..cb5296ec3 100644 --- a/tests/libtest/lib510.c +++ b/tests/libtest/lib510.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -63,19 +63,19 @@ int test(char *URL) struct WriteThis pooh; pooh.counter = 0; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } slist = curl_slist_append(slist, "Transfer-Encoding: chunked"); - if (slist == NULL) { + if(slist == NULL) { fprintf(stderr, "curl_slist_append() failed\n"); curl_easy_cleanup(curl); curl_global_cleanup(); diff --git a/tests/libtest/lib511.c b/tests/libtest/lib511.c index 81dc75311..0b7ae6f43 100644 --- a/tests/libtest/lib511.c +++ b/tests/libtest/lib511.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib513.c b/tests/libtest/lib513.c index 6462ac7d5..58091ef6a 100644 --- a/tests/libtest/lib513.c +++ b/tests/libtest/lib513.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,12 +37,12 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib514.c b/tests/libtest/lib514.c index 916ed6b93..f516d0942 100644 --- a/tests/libtest/lib514.c +++ b/tests/libtest/lib514.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index d982145ac..d3e6e446a 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib516.c b/tests/libtest/lib516.c index 4c04af63f..9faf262c6 100644 --- a/tests/libtest/lib516.c +++ b/tests/libtest/lib516.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c index 94343f67c..e37a7771d 100644 --- a/tests/libtest/lib518.c +++ b/tests/libtest/lib518.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -56,18 +56,19 @@ static char msgbuff[256]; static void store_errmsg(const char *msg, int err) { - if (!err) - sprintf(msgbuff, "%s", msg); + if(!err) + snprintf(msgbuff, sizeof(msgbuff), "%s", msg); else - sprintf(msgbuff, "%s, errno %d, %s", msg, err, strerror(err)); + snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, + err, strerror(err)); } static void close_file_descriptors(void) { - for (num_open.rlim_cur = 0; - num_open.rlim_cur < num_open.rlim_max; - num_open.rlim_cur++) - if (fd[num_open.rlim_cur] > 0) + for(num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) + if(fd[num_open.rlim_cur] > 0) close(fd[num_open.rlim_cur]); free(fd); fd = NULL; @@ -79,20 +80,20 @@ static int fopen_works(void) int i; int ret = 1; - for (i = 0; i < 3; i++) { + for(i = 0; i < 3; i++) { fpa[i] = NULL; } - for (i = 0; i < 3; i++) { - fpa[i] = fopen(DEV_NULL, "r"); - if (fpa[i] == NULL) { - store_errmsg("fopen() failed", ERRNO); + for(i = 0; i < 3; i++) { + fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT); + if(fpa[i] == NULL) { + store_errmsg("fopen failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); ret = 0; break; } } - for (i = 0; i < 3; i++) { - if (fpa[i] != NULL) + for(i = 0; i < 3; i++) { + if(fpa[i] != NULL) fclose(fpa[i]); } return ret; @@ -112,7 +113,7 @@ static int rlimit(int keep_open) #ifdef HAVE_LONGLONG char fmt_llu[] = "%llu"; - if (sizeof(rl.rlim_max) > sizeof(long)) + if(sizeof(rl.rlim_max) > sizeof(long)) fmt = fmt_llu; else #endif @@ -120,7 +121,7 @@ static int rlimit(int keep_open) /* get initial open file limits */ - if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -1; @@ -129,19 +130,19 @@ static int rlimit(int keep_open) /* show initial open file limits */ #ifdef RLIM_INFINITY - if (rl.rlim_cur == RLIM_INFINITY) + if(rl.rlim_cur == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_cur); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur); fprintf(stderr, "initial soft limit: %s\n", strbuff); #ifdef RLIM_INFINITY - if (rl.rlim_max == RLIM_INFINITY) + if(rl.rlim_max == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max); fprintf(stderr, "initial hard limit: %s\n", strbuff); /* show our constants */ @@ -159,14 +160,14 @@ static int rlimit(int keep_open) * open more than soft limit file descriptors will fail. */ - if (rl.rlim_cur != rl.rlim_max) { + if(rl.rlim_cur != rl.rlim_max) { #ifdef OPEN_MAX - if ((rl.rlim_cur > 0) && - (rl.rlim_cur < OPEN_MAX)) { + if((rl.rlim_cur > 0) && + (rl.rlim_cur < OPEN_MAX)) { fprintf(stderr, "raising soft limit up to OPEN_MAX\n"); rl.rlim_cur = OPEN_MAX; - if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { /* on failure don't abort just issue a warning */ store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); @@ -177,7 +178,7 @@ static int rlimit(int keep_open) fprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; - if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { /* on failure don't abort just issue a warning */ store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); @@ -186,7 +187,7 @@ static int rlimit(int keep_open) /* get current open file limits */ - if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -3; @@ -195,19 +196,19 @@ static int rlimit(int keep_open) /* show current open file limits */ #ifdef RLIM_INFINITY - if (rl.rlim_cur == RLIM_INFINITY) + if(rl.rlim_cur == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_cur); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur); fprintf(stderr, "current soft limit: %s\n", strbuff); #ifdef RLIM_INFINITY - if (rl.rlim_max == RLIM_INFINITY) + if(rl.rlim_max == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max); fprintf(stderr, "current hard limit: %s\n", strbuff); } /* (rl.rlim_cur != rl.rlim_max) */ @@ -229,15 +230,15 @@ static int rlimit(int keep_open) num_open.rlim_cur = NUM_NEEDED; - if ((rl.rlim_cur > 0) && + if((rl.rlim_cur > 0) && #ifdef RLIM_INFINITY (rl.rlim_cur != RLIM_INFINITY) && #endif (rl.rlim_cur <= num_open.rlim_cur)) { - sprintf(strbuff2, fmt, rl.rlim_cur); - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "fds needed %s > system limit %s", - strbuff1, strbuff2); + snprintf(strbuff2, sizeof(strbuff2), fmt, rl.rlim_cur); + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s", + strbuff1, strbuff2); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); return -4; @@ -252,21 +253,21 @@ static int rlimit(int keep_open) * that it becomes available to the test. */ - for (nitems = i = 1; nitems <= i; i *= 2) + for(nitems = i = 1; nitems <= i; i *= 2) nitems = i; - if (nitems > 0x7fff) + if(nitems > 0x7fff) nitems = 0x40000; do { num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems; - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "allocating memchunk %s byte array\n", strbuff); memchunk = malloc(sizeof(*memchunk) * (size_t)nitems); - if (!memchunk) { + if(!memchunk) { fprintf(stderr, "memchunk, malloc() failed\n"); nitems /= 2; } - } while (nitems && !memchunk); - if (!memchunk) { + } while(nitems && !memchunk); + if(!memchunk) { store_errmsg("memchunk, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -5; @@ -276,7 +277,7 @@ static int rlimit(int keep_open) fprintf(stderr, "initializing memchunk array\n"); - for (i = 0; i < nitems; i++) + for(i = 0; i < nitems; i++) memchunk[i] = -1; /* set the number of file descriptors we will try to open */ @@ -285,10 +286,10 @@ static int rlimit(int keep_open) /* verify that we won't overflow size_t in malloc() */ - if ((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) { - sprintf(strbuff1, fmt, num_open.rlim_max); - sprintf(strbuff, "unable to allocate an array for %s " - "file descriptors, would overflow size_t", strbuff1); + if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) { + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s " + "file descriptors, would overflow size_t", strbuff1); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); free(memchunk); @@ -297,11 +298,11 @@ static int rlimit(int keep_open) /* allocate array for file descriptors */ - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "allocating array for %s file descriptors\n", strbuff); fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max)); - if (!fd) { + if(!fd) { store_errmsg("fd, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); free(memchunk); @@ -312,19 +313,19 @@ static int rlimit(int keep_open) fprintf(stderr, "initializing fd array\n"); - for (num_open.rlim_cur = 0; - num_open.rlim_cur < num_open.rlim_max; - num_open.rlim_cur++) + for(num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) fd[num_open.rlim_cur] = -1; - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "trying to open %s file descriptors\n", strbuff); /* open a dummy descriptor */ fd[0] = open(DEV_NULL, O_RDONLY); - if (fd[0] < 0) { - sprintf(strbuff, "opening of %s failed", DEV_NULL); + if(fd[0] < 0) { + snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL); store_errmsg(strbuff, ERRNO); fprintf(stderr, "%s\n", msgbuff); free(fd); @@ -335,36 +336,37 @@ static int rlimit(int keep_open) /* create a bunch of file descriptors */ - for (num_open.rlim_cur = 1; - num_open.rlim_cur < num_open.rlim_max; - num_open.rlim_cur++) { + for(num_open.rlim_cur = 1; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) { fd[num_open.rlim_cur] = dup(fd[0]); - if (fd[num_open.rlim_cur] < 0) { + if(fd[num_open.rlim_cur] < 0) { fd[num_open.rlim_cur] = -1; - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "dup() attempt %s failed", strbuff1); + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1); fprintf(stderr, "%s\n", strbuff); - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "fds system limit seems close to %s", strbuff1); + snprintf(strbuff1, sizeof(strbuff), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s", + strbuff1); fprintf(stderr, "%s\n", strbuff); num_open.rlim_max = NUM_NEEDED; - sprintf(strbuff2, fmt, num_open.rlim_max); - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "fds needed %s > system limit %s", - strbuff2, strbuff1); + snprintf(strbuff2, sizeof(strbuff2), fmt, num_open.rlim_max); + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "fds needed %s > system limit %s", + strbuff2, strbuff1); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); - for (num_open.rlim_cur = 0; - fd[num_open.rlim_cur] >= 0; - num_open.rlim_cur++) + for(num_open.rlim_cur = 0; + fd[num_open.rlim_cur] >= 0; + num_open.rlim_cur++) close(fd[num_open.rlim_cur]); free(fd); fd = NULL; @@ -375,7 +377,7 @@ static int rlimit(int keep_open) } - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "%s file descriptors open\n", strbuff); #if !defined(HAVE_POLL_FINE) && \ @@ -394,8 +396,9 @@ static int rlimit(int keep_open) */ num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; - if (num_open.rlim_max > num_open.rlim_cur) { - sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + if(num_open.rlim_max > num_open.rlim_cur) { + snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", + FD_SETSIZE); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); close_file_descriptors(); @@ -404,12 +407,13 @@ static int rlimit(int keep_open) } num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; - for (rl.rlim_cur = 0; - rl.rlim_cur < num_open.rlim_max; - rl.rlim_cur++) { - if ((fd[rl.rlim_cur] > 0) && + for(rl.rlim_cur = 0; + rl.rlim_cur < num_open.rlim_max; + rl.rlim_cur++) { + if((fd[rl.rlim_cur] > 0) && ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) { - sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", + FD_SETSIZE); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); close_file_descriptors(); @@ -429,12 +433,14 @@ static int rlimit(int keep_open) * if it is capable of fopen()ing some additional files. */ - if (!fopen_works()) { - sprintf(strbuff1, fmt, num_open.rlim_max); - sprintf(strbuff, "stdio fopen() fails with %s fds open()", - strbuff1); + if(!fopen_works()) { + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), + "fopen fails with %s fds open()", + strbuff1); fprintf(stderr, "%s\n", msgbuff); - sprintf(strbuff, "stdio fopen() fails with lots of fds open()"); + snprintf(strbuff, sizeof(strbuff), + "fopen fails with lots of fds open()"); store_errmsg(strbuff, 0); close_file_descriptors(); free(memchunk); @@ -448,7 +454,7 @@ static int rlimit(int keep_open) /* close file descriptors unless instructed to keep them */ - if (!keep_open) { + if(!keep_open) { close_file_descriptors(); } @@ -469,7 +475,7 @@ int test(char *URL) return 0; /* sure, run this! */ } - if (rlimit(TRUE)) { + if(rlimit(TRUE)) { /* failure */ return TEST_ERR_MAJOR_BAD; } @@ -477,13 +483,13 @@ int test(char *URL) /* run the test with the bunch of open file descriptors and close them all once the test is over */ - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); close_file_descriptors(); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); close_file_descriptors(); curl_global_cleanup(); diff --git a/tests/libtest/lib519.c b/tests/libtest/lib519.c index a95bc3c1a..6e3059892 100644 --- a/tests/libtest/lib519.c +++ b/tests/libtest/lib519.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib520.c b/tests/libtest/lib520.c index 556b66b30..b5a71da27 100644 --- a/tests/libtest/lib520.c +++ b/tests/libtest/lib520.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib521.c b/tests/libtest/lib521.c index d15add773..40f4def4f 100644 --- a/tests/libtest/lib521.c +++ b/tests/libtest/lib521.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib523.c b/tests/libtest/lib523.c index 3272df42a..f3264690d 100644 --- a/tests/libtest/lib523.c +++ b/tests/libtest/lib523.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib524.c b/tests/libtest/lib524.c index e5ab187e0..3440562b2 100644 --- a/tests/libtest/lib524.c +++ b/tests/libtest/lib524.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c index 8290cad04..4bf259d21 100644 --- a/tests/libtest/lib525.c +++ b/tests/libtest/lib525.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -34,7 +34,7 @@ int test(char *URL) int res = 0; CURL *curl = NULL; FILE *hd_src = NULL; - int hd ; + int hd; int error; struct_stat file_info; CURLM *m = NULL; @@ -56,7 +56,7 @@ int test(char *URL) hd_src = fopen(libtest_arg2, "rb"); if(NULL == hd_src) { error = ERRNO; - fprintf(stderr, "fopen() failed with error: %d (%s)\n", + fprintf(stderr, "fopen failed with error: %d (%s)\n", error, strerror(error)); fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2); return TEST_ERR_FOPEN; @@ -86,7 +86,7 @@ int test(char *URL) easy_setopt(curl, CURLOPT_UPLOAD, 1L); /* specify target */ - easy_setopt(curl,CURLOPT_URL, URL); + easy_setopt(curl, CURLOPT_URL, URL); /* go verbose */ easy_setopt(curl, CURLOPT_VERBOSE, 1L); diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index a3e2d0cb5..82bfab36c 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -53,7 +53,7 @@ int test(char *URL) /* get an easy handle */ easy_init(curl[i]); /* specify target */ - sprintf(target_url, "%s%04i", URL, i + 1); + snprintf(target_url, sizeof(target_url), "%s%04i", URL, i + 1); target_url[sizeof(target_url) - 1] = '\0'; easy_setopt(curl[i], CURLOPT_URL, target_url); /* go verbose */ diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c index 88cbceaec..c1561419a 100644 --- a/tests/libtest/lib537.c +++ b/tests/libtest/lib537.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -57,18 +57,19 @@ static char msgbuff[256]; static void store_errmsg(const char *msg, int err) { - if (!err) - sprintf(msgbuff, "%s", msg); + if(!err) + snprintf(msgbuff, sizeof(msgbuff), "%s", msg); else - sprintf(msgbuff, "%s, errno %d, %s", msg, err, strerror(err)); + snprintf(msgbuff, sizeof(msgbuff), "%s, errno %d, %s", msg, err, + strerror(err)); } static void close_file_descriptors(void) { - for (num_open.rlim_cur = 0; - num_open.rlim_cur < num_open.rlim_max; - num_open.rlim_cur++) - if (fd[num_open.rlim_cur] > 0) + for(num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) + if(fd[num_open.rlim_cur] > 0) close(fd[num_open.rlim_cur]); free(fd); fd = NULL; @@ -80,20 +81,20 @@ static int fopen_works(void) int i; int ret = 1; - for (i = 0; i < 3; i++) { + for(i = 0; i < 3; i++) { fpa[i] = NULL; } - for (i = 0; i < 3; i++) { - fpa[i] = fopen(DEV_NULL, "r"); - if (fpa[i] == NULL) { - store_errmsg("fopen() failed", ERRNO); + for(i = 0; i < 3; i++) { + fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT); + if(fpa[i] == NULL) { + store_errmsg("fopen failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); ret = 0; break; } } - for (i = 0; i < 3; i++) { - if (fpa[i] != NULL) + for(i = 0; i < 3; i++) { + if(fpa[i] != NULL) fclose(fpa[i]); } return ret; @@ -113,7 +114,7 @@ static int rlimit(int keep_open) #ifdef HAVE_LONGLONG char fmt_llu[] = "%llu"; - if (sizeof(rl.rlim_max) > sizeof(long)) + if(sizeof(rl.rlim_max) > sizeof(long)) fmt = fmt_llu; else #endif @@ -121,7 +122,7 @@ static int rlimit(int keep_open) /* get initial open file limits */ - if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -1; @@ -130,19 +131,19 @@ static int rlimit(int keep_open) /* show initial open file limits */ #ifdef RLIM_INFINITY - if (rl.rlim_cur == RLIM_INFINITY) + if(rl.rlim_cur == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_cur); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur); fprintf(stderr, "initial soft limit: %s\n", strbuff); #ifdef RLIM_INFINITY - if (rl.rlim_max == RLIM_INFINITY) + if(rl.rlim_max == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max); fprintf(stderr, "initial hard limit: %s\n", strbuff); /* @@ -154,14 +155,14 @@ static int rlimit(int keep_open) * open more than soft limit file descriptors will fail. */ - if (rl.rlim_cur != rl.rlim_max) { + if(rl.rlim_cur != rl.rlim_max) { #ifdef OPEN_MAX - if ((rl.rlim_cur > 0) && + if((rl.rlim_cur > 0) && (rl.rlim_cur < OPEN_MAX)) { fprintf(stderr, "raising soft limit up to OPEN_MAX\n"); rl.rlim_cur = OPEN_MAX; - if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { /* on failure don't abort just issue a warning */ store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); @@ -172,7 +173,7 @@ static int rlimit(int keep_open) fprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; - if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(setrlimit(RLIMIT_NOFILE, &rl) != 0) { /* on failure don't abort just issue a warning */ store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); @@ -181,7 +182,7 @@ static int rlimit(int keep_open) /* get current open file limits */ - if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { + if(getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -3; @@ -190,19 +191,19 @@ static int rlimit(int keep_open) /* show current open file limits */ #ifdef RLIM_INFINITY - if (rl.rlim_cur == RLIM_INFINITY) + if(rl.rlim_cur == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_cur); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_cur); fprintf(stderr, "current soft limit: %s\n", strbuff); #ifdef RLIM_INFINITY - if (rl.rlim_max == RLIM_INFINITY) + if(rl.rlim_max == RLIM_INFINITY) strcpy(strbuff, "INFINITY"); else #endif - sprintf(strbuff, fmt, rl.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, rl.rlim_max); fprintf(stderr, "current hard limit: %s\n", strbuff); } /* (rl.rlim_cur != rl.rlim_max) */ @@ -226,21 +227,21 @@ static int rlimit(int keep_open) * that it becomes available to the test. */ - for (nitems = i = 1; nitems <= i; i *= 2) + for(nitems = i = 1; nitems <= i; i *= 2) nitems = i; - if (nitems > 0x7fff) + if(nitems > 0x7fff) nitems = 0x40000; do { num_open.rlim_max = sizeof(*memchunk) * (size_t)nitems; - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "allocating memchunk %s byte array\n", strbuff); memchunk = malloc(sizeof(*memchunk) * (size_t)nitems); - if (!memchunk) { + if(!memchunk) { fprintf(stderr, "memchunk, malloc() failed\n"); nitems /= 2; } - } while (nitems && !memchunk); - if (!memchunk) { + } while(nitems && !memchunk); + if(!memchunk) { store_errmsg("memchunk, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -4; @@ -250,34 +251,34 @@ static int rlimit(int keep_open) fprintf(stderr, "initializing memchunk array\n"); - for (i = 0; i < nitems; i++) + for(i = 0; i < nitems; i++) memchunk[i] = -1; /* set the number of file descriptors we will try to open */ #ifdef RLIM_INFINITY - if ((rl.rlim_cur > 0) && (rl.rlim_cur != RLIM_INFINITY)) { + if((rl.rlim_cur > 0) && (rl.rlim_cur != RLIM_INFINITY)) { #else - if (rl.rlim_cur > 0) { + if(rl.rlim_cur > 0) { #endif /* soft limit minus SAFETY_MARGIN */ num_open.rlim_max = rl.rlim_cur - SAFETY_MARGIN; } else { /* a huge number of file descriptors */ - for (nitems = i = 1; nitems <= i; i *= 2) + for(nitems = i = 1; nitems <= i; i *= 2) nitems = i; - if (nitems > 0x7fff) + if(nitems > 0x7fff) nitems = 0x40000; num_open.rlim_max = nitems; } /* verify that we won't overflow size_t in malloc() */ - if ((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) { - sprintf(strbuff1, fmt, num_open.rlim_max); - sprintf(strbuff, "unable to allocate an array for %s " - "file descriptors, would overflow size_t", strbuff1); + if((size_t)(num_open.rlim_max) > ((size_t)-1) / sizeof(*fd)) { + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), "unable to allocate an array for %s " + "file descriptors, would overflow size_t", strbuff1); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); free(memchunk); @@ -287,15 +288,15 @@ static int rlimit(int keep_open) /* allocate array for file descriptors */ do { - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "allocating array for %s file descriptors\n", strbuff); fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max)); - if (!fd) { + if(!fd) { fprintf(stderr, "fd, malloc() failed\n"); num_open.rlim_max /= 2; } - } while (num_open.rlim_max && !fd); - if (!fd) { + } while(num_open.rlim_max && !fd); + if(!fd) { store_errmsg("fd, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); free(memchunk); @@ -306,19 +307,19 @@ static int rlimit(int keep_open) fprintf(stderr, "initializing fd array\n"); - for (num_open.rlim_cur = 0; - num_open.rlim_cur < num_open.rlim_max; - num_open.rlim_cur++) + for(num_open.rlim_cur = 0; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) fd[num_open.rlim_cur] = -1; - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "trying to open %s file descriptors\n", strbuff); /* open a dummy descriptor */ fd[0] = open(DEV_NULL, O_RDONLY); - if (fd[0] < 0) { - sprintf(strbuff, "opening of %s failed", DEV_NULL); + if(fd[0] < 0) { + snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL); store_errmsg(strbuff, ERRNO); fprintf(stderr, "%s\n", msgbuff); free(fd); @@ -329,45 +330,47 @@ static int rlimit(int keep_open) /* create a bunch of file descriptors */ - for (num_open.rlim_cur = 1; - num_open.rlim_cur < num_open.rlim_max; - num_open.rlim_cur++) { + for(num_open.rlim_cur = 1; + num_open.rlim_cur < num_open.rlim_max; + num_open.rlim_cur++) { fd[num_open.rlim_cur] = dup(fd[0]); - if (fd[num_open.rlim_cur] < 0) { + if(fd[num_open.rlim_cur] < 0) { fd[num_open.rlim_cur] = -1; - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "dup() attempt %s failed", strbuff1); + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "dup() attempt %s failed", strbuff1); fprintf(stderr, "%s\n", strbuff); - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "fds system limit seems close to %s", strbuff1); + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "fds system limit seems close to %s", + strbuff1); fprintf(stderr, "%s\n", strbuff); num_open.rlim_max = num_open.rlim_cur - SAFETY_MARGIN; num_open.rlim_cur -= num_open.rlim_max; - sprintf(strbuff1, fmt, num_open.rlim_cur); - sprintf(strbuff, "closing %s file descriptors", strbuff1); + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_cur); + snprintf(strbuff, sizeof(strbuff), "closing %s file descriptors", + strbuff1); fprintf(stderr, "%s\n", strbuff); - for (num_open.rlim_cur = num_open.rlim_max; - fd[num_open.rlim_cur] >= 0; - num_open.rlim_cur++) { + for(num_open.rlim_cur = num_open.rlim_max; + fd[num_open.rlim_cur] >= 0; + num_open.rlim_cur++) { close(fd[num_open.rlim_cur]); fd[num_open.rlim_cur] = -1; } - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "shrinking array for %s file descriptors\n", strbuff); /* we don't care if we can't shrink it */ tmpfd = realloc(fd, sizeof(*fd) * (size_t)(num_open.rlim_max)); - if (tmpfd) { + if(tmpfd) { fd = tmpfd; tmpfd = NULL; } @@ -378,7 +381,7 @@ static int rlimit(int keep_open) } - sprintf(strbuff, fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), fmt, num_open.rlim_max); fprintf(stderr, "%s file descriptors open\n", strbuff); #if !defined(HAVE_POLL_FINE) && \ @@ -397,8 +400,9 @@ static int rlimit(int keep_open) */ num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; - if (num_open.rlim_max > num_open.rlim_cur) { - sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + if(num_open.rlim_max > num_open.rlim_cur) { + snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", + FD_SETSIZE); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); close_file_descriptors(); @@ -407,12 +411,13 @@ static int rlimit(int keep_open) } num_open.rlim_cur = FD_SETSIZE - SAFETY_MARGIN; - for (rl.rlim_cur = 0; - rl.rlim_cur < num_open.rlim_max; - rl.rlim_cur++) { - if ((fd[rl.rlim_cur] > 0) && + for(rl.rlim_cur = 0; + rl.rlim_cur < num_open.rlim_max; + rl.rlim_cur++) { + if((fd[rl.rlim_cur] > 0) && ((unsigned int)fd[rl.rlim_cur] > num_open.rlim_cur)) { - sprintf(strbuff, "select limit is FD_SETSIZE %d", FD_SETSIZE); + snprintf(strbuff, sizeof(strbuff), "select limit is FD_SETSIZE %d", + FD_SETSIZE); store_errmsg(strbuff, 0); fprintf(stderr, "%s\n", msgbuff); close_file_descriptors(); @@ -432,12 +437,12 @@ static int rlimit(int keep_open) * if it is capable of fopen()ing some additional files. */ - if (!fopen_works()) { - sprintf(strbuff1, fmt, num_open.rlim_max); - sprintf(strbuff, "stdio fopen() fails with %s fds open()", + if(!fopen_works()) { + snprintf(strbuff1, sizeof(strbuff1), fmt, num_open.rlim_max); + snprintf(strbuff, sizeof(strbuff), "fopen fails with %s fds open", strbuff1); fprintf(stderr, "%s\n", msgbuff); - sprintf(strbuff, "stdio fopen() fails with lots of fds open()"); + snprintf(strbuff, sizeof(strbuff), "fopen fails with lots of fds open"); store_errmsg(strbuff, 0); close_file_descriptors(); free(memchunk); @@ -451,7 +456,7 @@ static int rlimit(int keep_open) /* close file descriptors unless instructed to keep them */ - if (!keep_open) { + if(!keep_open) { close_file_descriptors(); } @@ -472,7 +477,7 @@ int test(char *URL) return 0; /* sure, run this! */ } - if (rlimit(TRUE)) { + if(rlimit(TRUE)) { /* failure */ return TEST_ERR_MAJOR_BAD; } @@ -480,13 +485,13 @@ int test(char *URL) /* run the test with the bunch of open file descriptors and close them all once the test is over */ - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); close_file_descriptors(); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); close_file_descriptors(); curl_global_cleanup(); diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c index c6ca0d258..9f0f8fabf 100644 --- a/tests/libtest/lib539.c +++ b/tests/libtest/lib539.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -30,12 +30,12 @@ int test(char *URL) char *newURL = NULL; struct curl_slist *slist = NULL; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -58,16 +58,15 @@ int test(char *URL) * even though no directories are stored in the ftpconn->dirs array (after a * call to freedirs). */ - newURL = malloc(strlen(URL) + 3); - if (newURL == NULL) { + newURL = aprintf("%s./", URL); + if(newURL == NULL) { curl_easy_cleanup(curl); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } - newURL = strcat(strcpy(newURL, URL), "./"); slist = curl_slist_append (NULL, "SYST"); - if (slist == NULL) { + if(slist == NULL) { free(newURL); curl_easy_cleanup(curl); curl_global_cleanup(); diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c index 62d8dfd1d..9b3b5a40e 100644 --- a/tests/libtest/lib540.c +++ b/tests/libtest/lib540.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -113,7 +113,7 @@ static int loop(int num, CURLM *cm, const char* url, const char* userpwd, if(res) return res; - while (U) { + while(U) { int M = -99; @@ -125,7 +125,7 @@ static int loop(int num, CURLM *cm, const char* url, const char* userpwd, if(res) return res; - if (U) { + if(U) { FD_ZERO(&R); FD_ZERO(&W); FD_ZERO(&E); @@ -200,7 +200,7 @@ int test(char *URL) if(test_argc < 4) return 99; - sprintf(buffer, "Host: %s", HOST); + snprintf(buffer, sizeof(buffer), "Host: %s", HOST); /* now add a custom Host: header */ headers = curl_slist_append(headers, buffer); diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c index 64c7d20f5..604446a2e 100644 --- a/tests/libtest/lib541.c +++ b/tests/libtest/lib541.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -35,12 +35,12 @@ int test(char *URL) { CURL *curl; CURLcode res = CURLE_OK; - FILE *hd_src ; + FILE *hd_src; int hd; struct_stat file_info; int error; - if (!libtest_arg2) { + if(!libtest_arg2) { fprintf(stderr, "Usage: <url> <file-to-upload>\n"); return TEST_ERR_USAGE; } @@ -48,7 +48,7 @@ int test(char *URL) hd_src = fopen(libtest_arg2, "rb"); if(NULL == hd_src) { error = ERRNO; - fprintf(stderr, "fopen() failed with error: %d %s\n", + fprintf(stderr, "fopen failed with error: %d %s\n", error, strerror(error)); fprintf(stderr, "Error opening file: %s\n", libtest_arg2); return -2; /* if this happens things are major weird */ @@ -72,14 +72,14 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); fclose(hd_src); return TEST_ERR_MAJOR_BAD; } /* get a curl handle */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); fclose(hd_src); @@ -93,7 +93,7 @@ int test(char *URL) test_setopt(curl, CURLOPT_VERBOSE, 1L); /* specify target */ - test_setopt(curl,CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_URL, URL); /* now specify which file to upload */ test_setopt(curl, CURLOPT_READDATA, hd_src); diff --git a/tests/libtest/lib542.c b/tests/libtest/lib542.c index 0d0d574fc..c82ccd5b7 100644 --- a/tests/libtest/lib542.c +++ b/tests/libtest/lib542.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -36,13 +36,13 @@ int test(char *URL) CURL *curl; CURLcode res = CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } /* get a curl handle */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -58,7 +58,7 @@ int test(char *URL) test_setopt(curl, CURLOPT_HEADER, 0L); /* specify target */ - test_setopt(curl,CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_URL, URL); /* Now run off and do what you've been told! */ res = curl_easy_perform(curl); diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c index 367248389..8fec052d2 100644 --- a/tests/libtest/lib543.c +++ b/tests/libtest/lib543.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -36,7 +36,7 @@ int test(char *URL) char *s; (void)URL; - if ((easy = curl_easy_init()) == NULL) { + if((easy = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); return TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c index 9bd80d875..4b08a0a76 100644 --- a/tests/libtest/lib544.c +++ b/tests/libtest/lib544.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -42,12 +42,12 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c index c282be186..4ec42a330 100644 --- a/tests/libtest/lib547.c +++ b/tests/libtest/lib547.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -85,12 +85,12 @@ int test(char *URL) int counter=0; #endif - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -108,7 +108,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_IOCTLDATA, &counter); test_setopt(curl, CURLOPT_READFUNCTION, readcallback); test_setopt(curl, CURLOPT_READDATA, &counter); - /* We CANNOT do the POST fine without setting the size (or choose chunked)! */ + /* We CANNOT do the POST fine without setting the size (or choose + chunked)! */ test_setopt(curl, CURLOPT_POSTFIELDSIZE, (long)strlen(UPLOADTHIS)); #endif test_setopt(curl, CURLOPT_POST, 1L); diff --git a/tests/libtest/lib549.c b/tests/libtest/lib549.c index 961a4ba5b..137029548 100644 --- a/tests/libtest/lib549.c +++ b/tests/libtest/lib549.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -33,12 +33,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index 408b60cdb..9fe4a7168 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -63,14 +63,14 @@ void dump(const char *text, for(c = 0; (c < width) && (i+c < size); c++) { /* check for 0D0A; if found, skip past and start a new line of output */ - if (nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { + if(nohex && (i+c+1 < size) && ptr[i+c]==0x0D && ptr[i+c+1]==0x0A) { i+=(c+2-width); break; } fprintf(stream, "%c", (ptr[i+c]>=0x20) && (ptr[i+c]<0x80)?ptr[i+c]:'.'); /* check again for 0D0A, to avoid an extra \n if it's at width */ - if (nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { + if(nohex && (i+c+2 < size) && ptr[i+c+1]==0x0D && ptr[i+c+2]==0x0A) { i+=(c+3-width); break; } @@ -121,12 +121,14 @@ int my_trace(CURL *handle, curl_infotype type, static size_t current_offset = 0; -static char databuf[70000]; /* MUST be more than 64k OR MAX_INITIAL_POST_SIZE */ +static char databuf[70000]; /* MUST be more than 64k OR + MAX_INITIAL_POST_SIZE */ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) { size_t amount = nmemb * size; /* Total bytes curl wants */ - size_t available = sizeof(databuf) - current_offset; /* What we have to give */ + size_t available = sizeof(databuf) - current_offset; /* What we have to + give */ size_t given = amount < available ? amount : available; /* What is given */ (void)stream; memcpy(ptr, databuf + current_offset, given); @@ -135,7 +137,8 @@ static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream) } -static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) +static size_t write_callback(void *ptr, size_t size, size_t nmemb, + void *stream) { int amount = curlx_uztosi(size * nmemb); printf("%.*s", amount, (char *)ptr); @@ -147,7 +150,7 @@ static size_t write_callback(void *ptr, size_t size, size_t nmemb, void *stream) static curlioerr ioctl_callback(CURL * handle, int cmd, void *clientp) { (void)clientp; - if (cmd == CURLIOCMD_RESTARTREAD ) { + if(cmd == CURLIOCMD_RESTARTREAD) { printf("APPLICATION: recieved a CURLIOCMD_RESTARTREAD request\n"); printf("APPLICATION: ** REWINDING! **\n"); current_offset = 0; @@ -181,7 +184,7 @@ int test(char *URL) test_setopt(curl, CURLOPT_VERBOSE, 1L); /* setup repeated data string */ - for (i=0; i < sizeof(databuf); ++i) + for(i=0; i < sizeof(databuf); ++i) databuf[i] = fill[i % sizeof fill]; /* Post */ @@ -206,7 +209,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_URL, URL); - /* Accept any auth. But for this bug configure proxy with DIGEST, basic might work too, not NTLM */ + /* Accept any auth. But for this bug configure proxy with DIGEST, basic + might work too, not NTLM */ test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY); res = curl_easy_perform(curl); diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c index 96d569901..9afaad48f 100644 --- a/tests/libtest/lib553.c +++ b/tests/libtest/lib553.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -39,7 +39,7 @@ static size_t myreadfunc(void *ptr, size_t size, size_t nmemb, void *stream) memset(buf, 'A', sizeof(buf)); size *= nmemb; - if (size > total) + if(size > total) size = total; if(size > sizeof(buf)) @@ -73,18 +73,18 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - for (i = 0; i < NUM_HEADERS; i++) { - int len = sprintf(buf, "Header%d: ", i); + for(i = 0; i < NUM_HEADERS; i++) { + int len = snprintf(buf, sizeof(buf), "Header%d: ", i); memset(&buf[len], 'A', SIZE_HEADERS); buf[len + SIZE_HEADERS]=0; /* zero terminate */ hl = curl_slist_append(headerlist, buf); - if (!hl) + if(!hl) goto test_cleanup; headerlist = hl; } hl = curl_slist_append(headerlist, "Expect: "); - if (!hl) + if(!hl) goto test_cleanup; headerlist = hl; diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 23f0e2397..803df26d1 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -162,7 +162,7 @@ static int once(char *URL, bool oldstyle) if(formrc) printf("curl_formadd(4) = %d\n", (int)formrc); - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_formfree(formpost); curl_global_cleanup(); @@ -208,7 +208,7 @@ int test(char *URL) { int res; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib555.c b/tests/libtest/lib555.c index fea4ea48c..e84af87e5 100644 --- a/tests/libtest/lib555.c +++ b/tests/libtest/lib555.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -96,7 +96,8 @@ int test(char *URL) easy_setopt(curl, CURLOPT_IOCTLDATA, &counter); easy_setopt(curl, CURLOPT_READFUNCTION, readcallback); easy_setopt(curl, CURLOPT_READDATA, &counter); - /* We CANNOT do the POST fine without setting the size (or choose chunked)! */ + /* We CANNOT do the POST fine without setting the size (or choose + chunked)! */ easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(UPLOADTHIS)); easy_setopt(curl, CURLOPT_POST, 1L); @@ -113,7 +114,7 @@ int test(char *URL) multi_add_handle(m, curl); - while (running) { + while(running) { struct timeval timeout; fd_set fdread, fdwrite, fdexcep; int maxfd = -99; diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index 3c1ff0ebb..527935396 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,12 +40,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib557.c b/tests/libtest/lib557.c index 2c0d5e0e9..5bdb8abe0 100644 --- a/tests/libtest/lib557.c +++ b/tests/libtest/lib557.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -453,6 +453,7 @@ static int test_unsigned_int_formatting(void) #elif (SIZEOF_INT == 8) + /* !checksrc! disable LONGLINE all */ i=1; ui_test[i].num = 0xFFFFFFFFFFFFFFFFU; ui_test[i].expected = "18446744073709551615"; i++; ui_test[i].num = 0xFFFFFFFF00000000U; ui_test[i].expected = "18446744069414584320"; i++; ui_test[i].num = 0x00000000FFFFFFFFU; ui_test[i].expected = "4294967295"; @@ -1344,6 +1345,7 @@ static int test_curl_off_t_formatting(void) num_cofft_tests = i; #endif + /* !checksrc! enable LONGLINE */ for(i=1; i<=num_cofft_tests; i++) { @@ -1351,11 +1353,12 @@ static int test_curl_off_t_formatting(void) co_test[i].result[j] = 'X'; co_test[i].result[BUFSZ-1] = '\0'; - (void)curl_msprintf(co_test[i].result, "%" CURL_FORMAT_CURL_OFF_T, co_test[i].num); + (void)curl_msprintf(co_test[i].result, "%" CURL_FORMAT_CURL_OFF_T, + co_test[i].num); if(memcmp(co_test[i].result, - co_test[i].expected, - strlen(co_test[i].expected))) { + co_test[i].expected, + strlen(co_test[i].expected))) { printf("curl_off_t test #%.2d: Failed (Expected: %s Got: %s)\n", i, co_test[i].expected, co_test[i].result); failed++; @@ -1371,6 +1374,53 @@ static int test_curl_off_t_formatting(void) return failed; } +static int string_check(char *buf, const char *buf2) +{ + if(strcmp(buf, buf2)) { + /* they shouldn't differ */ + printf("sprintf failed:\nwe '%s'\nsystem: '%s'\n", + buf, buf2); + return 1; + } + return 0; +} + +/* + * The output strings in this test need to have been verified with a system + * sprintf() before used here. + */ +static int test_string_formatting(void) +{ + int errors = 0; + char buf[256]; + curl_msnprintf(buf, sizeof(buf), "%0*d%s", 2, 9, "foo"); + errors += string_check(buf, "09foo"); + + curl_msnprintf(buf, sizeof(buf), "%*.*s", 5, 2, "foo"); + errors += string_check(buf, " fo"); + + curl_msnprintf(buf, sizeof(buf), "%*.*s", 2, 5, "foo"); + errors += string_check(buf, "foo"); + + curl_msnprintf(buf, sizeof(buf), "%*.*s", 0, 10, "foo"); + errors += string_check(buf, "foo"); + + curl_msnprintf(buf, sizeof(buf), "%-10s", "foo"); + errors += string_check(buf, "foo "); + + curl_msnprintf(buf, sizeof(buf), "%10s", "foo"); + errors += string_check(buf, " foo"); + + curl_msnprintf(buf, sizeof(buf), "%*.*s", -10, -10, "foo"); + errors += string_check(buf, "foo "); + + if(!errors) + printf("All curl_mprintf() strings tests OK!\n"); + else + printf("Some curl_mprintf() string tests Failed!\n"); + + return errors; +} int test(char *URL) { @@ -1391,6 +1441,8 @@ int test(char *URL) errors += test_curl_off_t_formatting(); + errors += test_string_formatting(); + if(errors) return TEST_ERR_MAJOR_BAD; else diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c index 39475635b..09a50d6b6 100644 --- a/tests/libtest/lib558.c +++ b/tests/libtest/lib558.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -33,7 +33,7 @@ int test(char *URL) (void)URL; /* we don't use this */ - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib562.c b/tests/libtest/lib562.c index b5c3970d9..819b50759 100644 --- a/tests/libtest/lib562.c +++ b/tests/libtest/lib562.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,13 +40,13 @@ int test(char *URL) CURL *curl; CURLcode res = CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } /* get a curl handle */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -59,7 +59,7 @@ int test(char *URL) test_setopt(curl, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10)); /* specify target */ - test_setopt(curl,CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_URL, URL); /* Now run off and do what you've been told! */ res = curl_easy_perform(curl); diff --git a/tests/libtest/lib566.c b/tests/libtest/lib566.c index fc03d4e7d..94a91d5dd 100644 --- a/tests/libtest/lib566.c +++ b/tests/libtest/lib566.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -30,12 +30,12 @@ int test(char *URL) double content_length = 3; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c index 080efb1a3..38e0c0b78 100644 --- a/tests/libtest/lib567.c +++ b/tests/libtest/lib567.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -32,12 +32,12 @@ int test(char *URL) CURL *curl; struct curl_slist *custom_headers=NULL; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c index 3dfb94887..9b3a07787 100644 --- a/tests/libtest/lib568.c +++ b/tests/libtest/lib568.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -50,12 +50,12 @@ int test(char *URL) int request=1; struct curl_slist *custom_headers=NULL; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -131,7 +131,8 @@ int test(char *URL) } test_setopt(curl, CURLOPT_RTSPHEADER, custom_headers); test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_ANNOUNCE); - test_setopt(curl, CURLOPT_POSTFIELDS, "postyfield=postystuff&project=curl\n"); + test_setopt(curl, CURLOPT_POSTFIELDS, + "postyfield=postystuff&project=curl\n"); res = curl_easy_perform(curl); if(res) diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c index 909a12cda..55282b69b 100644 --- a/tests/libtest/lib569.c +++ b/tests/libtest/lib569.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -47,13 +47,13 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); fclose(idfile); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); fclose(idfile); @@ -86,7 +86,8 @@ int test(char *URL) stream_uri = NULL; test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); - test_setopt(curl, CURLOPT_RTSP_TRANSPORT, "Fake/NotReal/JustATest;foo=baz"); + test_setopt(curl, CURLOPT_RTSP_TRANSPORT, + "Fake/NotReal/JustATest;foo=baz"); res = curl_easy_perform(curl); if(res) goto test_cleanup; diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c index db4498553..2dc57b761 100644 --- a/tests/libtest/lib570.c +++ b/tests/libtest/lib570.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -35,12 +35,12 @@ int test(char *URL) int request=1; char *stream_uri = NULL; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c index 95c868485..ad6c366b4 100644 --- a/tests/libtest/lib571.c +++ b/tests/libtest/lib571.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -75,8 +75,9 @@ static size_t rtp_write(void *ptr, size_t size, size_t nmemb, void *stream) { printf("RTP PAYLOAD CORRUPTED [%s]\n", data + i); return failure; } - } else { - if (memcmp(RTP_DATA, data + i, message_size - i) != 0) { + } + else { + if(memcmp(RTP_DATA, data + i, message_size - i) != 0) { printf("RTP PAYLOAD END CORRUPTED (%d), [%s]\n", message_size - i, data + i); return failure; @@ -110,13 +111,13 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); fclose(protofile); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); fclose(protofile); curl_global_cleanup(); diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c index 9e7a9feca..3475e8060 100644 --- a/tests/libtest/lib572.c +++ b/tests/libtest/lib572.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -50,12 +50,12 @@ int test(char *URL) int request=1; struct curl_slist *custom_headers=NULL; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib573.c b/tests/libtest/lib573.c index 527c19b61..dce198b50 100644 --- a/tests/libtest/lib573.c +++ b/tests/libtest/lib573.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -44,7 +44,7 @@ int test(char *URL) dbl_epsilon = 1.0; do { dbl_epsilon /= 2.0; - } while ((double)(1.0 + (dbl_epsilon/2.0)) > (double)1.0); + } while((double)(1.0 + (dbl_epsilon/2.0)) > (double)1.0); start_test_timing(); @@ -65,7 +65,7 @@ int test(char *URL) multi_add_handle(m, c); - while (running) { + while(running) { struct timeval timeout; fd_set fdread, fdwrite, fdexcep; int maxfd = -99; @@ -94,7 +94,7 @@ int test(char *URL) } curl_easy_getinfo(c, CURLINFO_CONNECT_TIME, &connect_time); - if (connect_time < dbl_epsilon) { + if(connect_time < dbl_epsilon) { fprintf(stderr, "connect time %e is < epsilon %e\n", connect_time, dbl_epsilon); res = TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib574.c b/tests/libtest/lib574.c index 6baeb00b9..9f9222b39 100644 --- a/tests/libtest/lib574.c +++ b/tests/libtest/lib574.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -35,12 +35,12 @@ int test(char *URL) int res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib576.c b/tests/libtest/lib576.c index 692faf392..3b9a9001d 100644 --- a/tests/libtest/lib576.c +++ b/tests/libtest/lib576.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -74,7 +74,8 @@ long chunk_bgn(const struct curl_fileinfo *finfo, void *ptr, int remains) } if(finfo->filetype == CURLFILETYPE_FILE) { ch_d->print_content = 1; - printf("Content:\n-------------------------------------------------------------\n"); + printf("Content:\n-----------------------" + "--------------------------------------\n"); } if(strcmp(finfo->filename, "someothertext.txt") == 0) { printf("# THIS CONTENT WAS SKIPPED IN CHUNK_BGN CALLBACK #\n"); @@ -100,7 +101,7 @@ int test(char *URL) { CURL *handle = NULL; CURLcode res = CURLE_OK; - chunk_data_t chunk_data = {0,0}; + chunk_data_t chunk_data = {0, 0}; curl_global_init(CURL_GLOBAL_ALL); handle = curl_easy_init(); if(!handle) { diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c index 9189d6e4f..5e01d36e0 100644 --- a/tests/libtest/lib578.c +++ b/tests/libtest/lib578.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,7 +28,8 @@ static char data[]="this is a short string.\n"; static size_t data_size = sizeof(data) / sizeof(char); -static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) +static int progress_callback(void *clientp, double dltotal, double dlnow, + double ultotal, double ulnow) { FILE *moo = fopen(libtest_arg2, "wb"); @@ -37,10 +38,11 @@ static int progress_callback(void *clientp, double dltotal, double dlnow, double (void)dlnow; /* UNUSED */ if(moo) { - if ((size_t)ultotal == data_size && (size_t)ulnow == data_size) + if((size_t)ultotal == data_size && (size_t)ulnow == data_size) fprintf(moo, "PASSED, UL data matched data size\n"); else - fprintf(moo, "Progress callback called with UL %f out of %f\n", ulnow, ultotal); + fprintf(moo, "Progress callback called with UL %f out of %f\n", + ulnow, ultotal); fclose(moo); } return 0; @@ -51,12 +53,12 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index fc9f79168..aae299ccc 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -92,19 +92,19 @@ int test(char *URL) struct WriteThis pooh; pooh.counter = 0; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } slist = curl_slist_append(slist, "Transfer-Encoding: chunked"); - if (slist == NULL) { + if(slist == NULL) { fprintf(stderr, "curl_slist_append() failed\n"); curl_easy_cleanup(curl); curl_global_cleanup(); diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index 738aa63c2..444b416ff 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -51,9 +51,9 @@ static void removeFd(struct Sockets* sockets, curl_socket_t fd, int mention) if(mention) fprintf(stderr, "Remove socket fd %d\n", (int) fd); - for (i = 0; i < sockets->count; ++i) { - if (sockets->sockets[i] == fd) { - if (i < sockets->count - 1) + for(i = 0; i < sockets->count; ++i) { + if(sockets->sockets[i] == fd) { + if(i < sockets->count - 1) memmove(&sockets->sockets[i], &sockets->sockets[i + 1], sizeof(curl_socket_t) * (sockets->count - (i + 1))); --sockets->count; @@ -110,10 +110,10 @@ static int curlSocketCallback(CURL *easy, curl_socket_t s, int action, (void)easy; /* unused */ (void)socketp; /* unused */ - if (action == CURL_POLL_IN || action == CURL_POLL_INOUT) + if(action == CURL_POLL_IN || action == CURL_POLL_INOUT) addFd(&sockets->read, s, "read"); - if (action == CURL_POLL_OUT || action == CURL_POLL_INOUT) + if(action == CURL_POLL_OUT || action == CURL_POLL_INOUT) addFd(&sockets->write, s, "write"); if(action == CURL_POLL_REMOVE) { @@ -132,7 +132,7 @@ static int curlTimerCallback(CURLM *multi, long timeout_ms, void *userp) struct timeval* timeout = userp; (void)multi; /* unused */ - if (timeout_ms != -1) { + if(timeout_ms != -1) { *timeout = tutil_tvnow(); timeout->tv_usec += timeout_ms * 1000; } @@ -151,10 +151,10 @@ static int checkForCompletion(CURLM* curl, int* success) CURLMsg* message; int result = 0; *success = 0; - while ((message = curl_multi_info_read(curl, &numMessages)) != NULL) { - if (message->msg == CURLMSG_DONE) { + while((message = curl_multi_info_read(curl, &numMessages)) != NULL) { + if(message->msg == CURLMSG_DONE) { result = 1; - if (message->data.result == CURLE_OK) + if(message->data.result == CURLE_OK) *success = 1; else *success = 0; @@ -176,7 +176,7 @@ static int getMicroSecondTimeout(struct timeval* timeout) now = tutil_tvnow(); result = (timeout->tv_sec - now.tv_sec) * 1000000 + timeout->tv_usec - now.tv_usec; - if (result < 0) + if(result < 0) result = 0; return curlx_sztosi(result); @@ -189,9 +189,9 @@ static void updateFdSet(struct Sockets* sockets, fd_set* fdset, curl_socket_t *maxFd) { int i; - for (i = 0; i < sockets->count; ++i) { + for(i = 0; i < sockets->count; ++i) { FD_SET(sockets->sockets[i], fdset); - if (*maxFd < sockets->sockets[i] + 1) { + if(*maxFd < sockets->sockets[i] + 1) { *maxFd = sockets->sockets[i] + 1; } } @@ -202,7 +202,7 @@ static void notifyCurl(CURLM *curl, curl_socket_t s, int evBitmask, { int numhandles = 0; CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles); - if (result != CURLM_OK) { + if(result != CURLM_OK) { fprintf(stderr, "Curl error on %s: %i (%s)\n", info, result, curl_multi_strerror(result)); } @@ -215,8 +215,8 @@ static void checkFdSet(CURLM *curl, struct Sockets *sockets, fd_set *fdset, int evBitmask, const char *name) { int i; - for (i = 0; i < sockets->count; ++i) { - if (FD_ISSET(sockets->sockets[i], fdset)) { + for(i = 0; i < sockets->count; ++i) { + if(FD_ISSET(sockets->sockets[i], fdset)) { notifyCurl(curl, sockets->sockets[i], evBitmask, name); } } @@ -227,7 +227,7 @@ int test(char *URL) int res = 0; CURL *curl = NULL; FILE *hd_src = NULL; - int hd ; + int hd; int error; struct_stat file_info; CURLM *m = NULL; @@ -237,7 +237,7 @@ int test(char *URL) start_test_timing(); - if (!libtest_arg3) { + if(!libtest_arg3) { fprintf(stderr, "Usage: lib582 [url] [filename] [username]\n"); return TEST_ERR_USAGE; } @@ -276,7 +276,7 @@ int test(char *URL) easy_setopt(curl, CURLOPT_UPLOAD, 1L); /* specify target */ - easy_setopt(curl,CURLOPT_URL, URL); + easy_setopt(curl, CURLOPT_URL, URL); /* go verbose */ easy_setopt(curl, CURLOPT_VERBOSE, 1L); @@ -300,8 +300,7 @@ int test(char *URL) multi_add_handle(m, curl); - while (!checkForCompletion(m, &success)) - { + while(!checkForCompletion(m, &success)) { fd_set readSet, writeSet; curl_socket_t maxFd = 0; struct timeval tv = {10, 0}; @@ -311,14 +310,12 @@ int test(char *URL) updateFdSet(&sockets.read, &readSet, &maxFd); updateFdSet(&sockets.write, &writeSet, &maxFd); - if (timeout.tv_sec != -1) - { + if(timeout.tv_sec != -1) { int usTimeout = getMicroSecondTimeout(&timeout); tv.tv_sec = usTimeout / 1000000; tv.tv_usec = usTimeout % 1000000; } - else if (maxFd <= 0) - { + else if(maxFd <= 0) { tv.tv_sec = 0; tv.tv_usec = 100000; } @@ -329,8 +326,7 @@ int test(char *URL) checkFdSet(m, &sockets.read, &readSet, CURL_CSELECT_IN, "read"); checkFdSet(m, &sockets.write, &writeSet, CURL_CSELECT_OUT, "write"); - if (timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) - { + if(timeout.tv_sec != -1 && getMicroSecondTimeout(&timeout) == 0) { /* Curl's timer has elapsed. */ notifyCurl(m, CURL_SOCKET_TIMEOUT, 0, "timeout"); } @@ -338,8 +334,7 @@ int test(char *URL) abort_on_test_timeout(); } - if (!success) - { + if(!success) { fprintf(stderr, "Error uploading file.\n"); res = TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index 3965c7461..eb7cfa0a9 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -36,8 +36,8 @@ struct userdata { }; /* lock callback */ -static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, - void *useptr ) +static void my_lock(CURL *handle, curl_lock_data data, + curl_lock_access laccess, void *useptr) { const char *what; struct userdata *user = (struct userdata *)useptr; @@ -45,7 +45,7 @@ static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, (void)handle; (void)laccess; - switch ( data ) { + switch (data) { case CURL_LOCK_DATA_SHARE: what = "share"; break; @@ -67,12 +67,12 @@ static void my_lock(CURL *handle, curl_lock_data data, curl_lock_access laccess, } /* unlock callback */ -static void my_unlock(CURL *handle, curl_lock_data data, void *useptr ) +static void my_unlock(CURL *handle, curl_lock_data data, void *useptr) { const char *what; struct userdata *user = (struct userdata *)useptr; (void)handle; - switch ( data ) { + switch ( data) { case CURL_LOCK_DATA_SHARE: what = "share"; break; @@ -101,7 +101,7 @@ static void *fire(void *ptr) CURL *curl; int i=0; - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); return NULL; } @@ -109,17 +109,17 @@ static void *fire(void *ptr) curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_URL, tdata->url); - printf( "CURLOPT_SHARE\n" ); + printf("CURLOPT_SHARE\n"); curl_easy_setopt(curl, CURLOPT_SHARE, tdata->share); - printf( "PERFORM\n" ); + printf("PERFORM\n"); code = curl_easy_perform(curl); - if( code != CURLE_OK ) { + if(code != CURLE_OK) { fprintf(stderr, "perform url '%s' repeat %d failed, curlcode %d\n", tdata->url, i, (int)code); } - printf( "CLEANUP\n" ); + printf("CLEANUP\n"); curl_easy_cleanup(curl); return NULL; @@ -140,38 +140,39 @@ int test(char *URL) user.text = (char *)"Pigs in space"; user.counter = 0; - printf( "GLOBAL_INIT\n" ); - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + printf("GLOBAL_INIT\n"); + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } /* prepare share */ - printf( "SHARE_INIT\n" ); - if ((share = curl_share_init()) == NULL) { + printf("SHARE_INIT\n"); + if((share = curl_share_init()) == NULL) { fprintf(stderr, "curl_share_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } - if ( CURLSHE_OK == scode ) { - printf( "CURLSHOPT_LOCKFUNC\n" ); - scode = curl_share_setopt( share, CURLSHOPT_LOCKFUNC, my_lock); + if(CURLSHE_OK == scode) { + printf("CURLSHOPT_LOCKFUNC\n"); + scode = curl_share_setopt(share, CURLSHOPT_LOCKFUNC, my_lock); } - if ( CURLSHE_OK == scode ) { - printf( "CURLSHOPT_UNLOCKFUNC\n" ); - scode = curl_share_setopt( share, CURLSHOPT_UNLOCKFUNC, my_unlock); + if(CURLSHE_OK == scode) { + printf("CURLSHOPT_UNLOCKFUNC\n"); + scode = curl_share_setopt(share, CURLSHOPT_UNLOCKFUNC, my_unlock); } - if ( CURLSHE_OK == scode ) { - printf( "CURLSHOPT_USERDATA\n" ); - scode = curl_share_setopt( share, CURLSHOPT_USERDATA, &user); + if(CURLSHE_OK == scode) { + printf("CURLSHOPT_USERDATA\n"); + scode = curl_share_setopt(share, CURLSHOPT_USERDATA, &user); } - if ( CURLSHE_OK == scode ) { - printf( "CURL_LOCK_DATA_SSL_SESSION\n" ); - scode = curl_share_setopt( share, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION); + if(CURLSHE_OK == scode) { + printf("CURL_LOCK_DATA_SSL_SESSION\n"); + scode = curl_share_setopt(share, CURLSHOPT_SHARE, + CURL_LOCK_DATA_SSL_SESSION); } - if ( CURLSHE_OK != scode ) { + if(CURLSHE_OK != scode) { fprintf(stderr, "curl_share_setopt() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); @@ -182,21 +183,21 @@ int test(char *URL) res = 0; /* start treads */ - for (i=1; i<=THREADS; i++ ) { + for(i=1; i<=THREADS; i++) { /* set thread data */ tdata.url = URL; tdata.share = share; /* simulate thread, direct call of "thread" function */ - printf( "*** run %d\n",i ); - fire( &tdata ); + printf("*** run %d\n",i); + fire(&tdata); } /* fetch a another one */ - printf( "*** run %d\n", i ); - if ((curl = curl_easy_init()) == NULL) { + printf("*** run %d\n", i); + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); @@ -204,38 +205,38 @@ int test(char *URL) } url = URL; - test_setopt( curl, CURLOPT_URL, url ); - printf( "CURLOPT_SHARE\n" ); - test_setopt( curl, CURLOPT_SHARE, share ); + test_setopt(curl, CURLOPT_URL, url); + printf("CURLOPT_SHARE\n"); + test_setopt(curl, CURLOPT_SHARE, share); - printf( "PERFORM\n" ); - curl_easy_perform( curl ); + printf("PERFORM\n"); + curl_easy_perform(curl); /* try to free share, expect to fail because share is in use*/ - printf( "try SHARE_CLEANUP...\n" ); - scode = curl_share_cleanup( share ); - if ( scode==CURLSHE_OK ) - { + printf("try SHARE_CLEANUP...\n"); + scode = curl_share_cleanup(share); + if(scode==CURLSHE_OK) { fprintf(stderr, "curl_share_cleanup succeed but error expected\n"); share = NULL; - } else { - printf( "SHARE_CLEANUP failed, correct\n" ); + } + else { + printf("SHARE_CLEANUP failed, correct\n"); } test_cleanup: /* clean up last handle */ - printf( "CLEANUP\n" ); - curl_easy_cleanup( curl ); + printf("CLEANUP\n"); + curl_easy_cleanup(curl); /* free share */ - printf( "SHARE_CLEANUP\n" ); - scode = curl_share_cleanup( share ); - if ( scode!=CURLSHE_OK ) + printf("SHARE_CLEANUP\n"); + scode = curl_share_cleanup(share); + if(scode!=CURLSHE_OK) fprintf(stderr, "curl_share_cleanup failed, code errno %d\n", (int)scode); - printf( "GLOBAL_CLEANUP\n" ); + printf("GLOBAL_CLEANUP\n"); curl_global_cleanup(); return res; diff --git a/tests/libtest/lib590.c b/tests/libtest/lib590.c index 44409afa6..7b863cc3f 100644 --- a/tests/libtest/lib590.c +++ b/tests/libtest/lib590.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,9 +28,9 @@ It is reproducible by the following steps: - Use a proxy that offers NTLM and Negotiate ( CURLOPT_PROXY and - CURLOPT_PROXYPORT ) + CURLOPT_PROXYPORT) - Tell libcurl NOT to use Negotiate CURL_EASY_SETOPT(CURLOPT_PROXYAUTH, - CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM ) + CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM) - Start the request */ @@ -41,12 +41,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib597.c b/tests/libtest/lib597.c index 493d4d8dc..813af7541 100644 --- a/tests/libtest/lib597.c +++ b/tests/libtest/lib597.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -69,7 +69,7 @@ int test(char *URL) multi_init(multi); - for (phase = CONNECT_ONLY_PHASE; phase < LAST_PHASE; ++phase) { + for(phase = CONNECT_ONLY_PHASE; phase < LAST_PHASE; ++phase) { /* go verbose */ easy_setopt(easy, CURLOPT_VERBOSE, 1L); @@ -77,11 +77,11 @@ int test(char *URL) easy_setopt(easy, CURLOPT_URL, URL); /* enable 'CONNECT_ONLY' option when in connect phase */ - if (phase == CONNECT_ONLY_PHASE) + if(phase == CONNECT_ONLY_PHASE) easy_setopt(easy, CURLOPT_CONNECT_ONLY, 1L); /* enable 'NOBODY' option to send 'QUIT' command in quit phase */ - if (phase == QUIT_PHASE) { + if(phase == QUIT_PHASE) { easy_setopt(easy, CURLOPT_CONNECT_ONLY, 0L); easy_setopt(easy, CURLOPT_NOBODY, 1L); easy_setopt(easy, CURLOPT_FORBID_REUSE, 1L); @@ -114,7 +114,8 @@ int test(char *URL) multi_timeout(multi, &timeout); - /* At this point, timeout is guaranteed to be greater or equal than -1. */ + /* At this point, timeout is guaranteed to be greater or equal than + -1. */ if(timeout != -1L) { int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeout; diff --git a/tests/libtest/lib598.c b/tests/libtest/lib598.c index 215ab5777..b107f29d4 100644 --- a/tests/libtest/lib598.c +++ b/tests/libtest/lib598.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -28,12 +28,12 @@ int test(char *URL) CURLcode res; CURL *curl; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib599.c b/tests/libtest/lib599.c index 20b089167..1dee0b978 100644 --- a/tests/libtest/lib599.c +++ b/tests/libtest/lib599.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -45,12 +45,12 @@ int test(char *URL) CURLcode res=CURLE_OK; double content_length = 0.0; - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -75,12 +75,12 @@ int test(char *URL) /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); - if (!res) { + if(!res) { FILE *moo; res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &content_length); moo = fopen(libtest_arg2, "wb"); - if (moo) { + if(moo) { fprintf(moo, "CL: %.0f\n", content_length); fclose(moo); } diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c index eabe5bfbe..994f9de06 100644 --- a/tests/libtest/libauthretry.c +++ b/tests/libtest/libauthretry.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -32,13 +32,14 @@ static CURLcode send_request(CURL *curl, const char *url, int seq, long auth_scheme, const char *userpwd) { CURLcode res; - char* full_url = malloc(strlen(url) + 4 + 1); - if (!full_url) { + size_t len = strlen(url) + 4 + 1; + char* full_url = malloc(len); + if(!full_url) { fprintf(stderr, "Not enough memory for full url\n"); return CURLE_OUT_OF_MEMORY; } - sprintf(full_url, "%s%04d", url, seq); + snprintf(full_url, len, "%s%04d", url, seq); fprintf(stderr, "Sending new request %d to %s with credential %s " "(auth %ld)\n", seq, full_url, userpwd, auth_scheme); test_setopt(curl, CURLOPT_URL, full_url); @@ -69,13 +70,13 @@ static CURLcode send_right_password(CURL *curl, const char *url, int seq, static long parse_auth_name(const char *arg) { - if (!arg) + if(!arg) return CURLAUTH_NONE; - if (strequal(arg, "basic")) + if(strequal(arg, "basic")) return CURLAUTH_BASIC; - if (strequal(arg, "digest")) + if(strequal(arg, "digest")) return CURLAUTH_DIGEST; - if (strequal(arg, "ntlm")) + if(strequal(arg, "ntlm")) return CURLAUTH_NTLM; return CURLAUTH_NONE; } @@ -88,58 +89,58 @@ int test(char *url) long main_auth_scheme = parse_auth_name(libtest_arg2); long fallback_auth_scheme = parse_auth_name(libtest_arg3); - if (main_auth_scheme == CURLAUTH_NONE || + if(main_auth_scheme == CURLAUTH_NONE || fallback_auth_scheme == CURLAUTH_NONE) { fprintf(stderr, "auth schemes not found on commandline\n"); return TEST_ERR_MAJOR_BAD; } - if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { fprintf(stderr, "curl_global_init() failed\n"); return TEST_ERR_MAJOR_BAD; } /* Send wrong password, then right password */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } res = send_wrong_password(curl, url, 100, main_auth_scheme); - if (res != CURLE_OK) - goto test_cleanup; + if(res != CURLE_OK) + goto test_cleanup; curl_easy_reset(curl); res = send_right_password(curl, url, 200, fallback_auth_scheme); - if (res != CURLE_OK) - goto test_cleanup; + if(res != CURLE_OK) + goto test_cleanup; curl_easy_reset(curl); curl_easy_cleanup(curl); /* Send wrong password twice, then right password */ - if ((curl = curl_easy_init()) == NULL) { + if((curl = curl_easy_init()) == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; } res = send_wrong_password(curl, url, 300, main_auth_scheme); - if (res != CURLE_OK) - goto test_cleanup; + if(res != CURLE_OK) + goto test_cleanup; curl_easy_reset(curl); res = send_wrong_password(curl, url, 400, fallback_auth_scheme); - if (res != CURLE_OK) - goto test_cleanup; + if(res != CURLE_OK) + goto test_cleanup; curl_easy_reset(curl); res = send_right_password(curl, url, 500, fallback_auth_scheme); - if (res != CURLE_OK) - goto test_cleanup; + if(res != CURLE_OK) + goto test_cleanup; curl_easy_reset(curl); test_cleanup: diff --git a/tests/libtest/libntlmconnect.c b/tests/libtest/libntlmconnect.c index a9609673d..736222dc6 100644 --- a/tests/libtest/libntlmconnect.c +++ b/tests/libtest/libntlmconnect.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2012 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2012 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -47,7 +47,7 @@ static size_t callback(char* ptr, size_t size, size_t nmemb, void* data) const size_t failure = (size * nmemb) ? 0 : 1; char *output = malloc(size * nmemb + 1); - if (!output) { + if(!output) { fprintf(stderr, "output, malloc() failed\n"); res = TEST_ERR_MAJOR_BAD; return failure; @@ -60,25 +60,25 @@ static size_t callback(char* ptr, size_t size, size_t nmemb, void* data) /* Get socket being used for this easy handle, otherwise CURL_SOCKET_BAD */ code = curl_easy_getinfo(easy[idx], CURLINFO_LASTSOCKET, &longdata); - if (CURLE_OK != code) { + if(CURLE_OK != code) { fprintf(stderr, "%s:%d curl_easy_getinfo() failed, " "with code %d (%s)\n", __FILE__, __LINE__, (int)code, curl_easy_strerror(code)); res = TEST_ERR_MAJOR_BAD; return failure; } - if (longdata == -1L) + if(longdata == -1L) sock = CURL_SOCKET_BAD; else sock = (curl_socket_t)longdata; - if (sock != CURL_SOCKET_BAD) { + if(sock != CURL_SOCKET_BAD) { /* Track relationship between this easy handle and the socket. */ - if (sockets[idx] == CURL_SOCKET_BAD) { + if(sockets[idx] == CURL_SOCKET_BAD) { /* An easy handle without previous socket, record the socket. */ sockets[idx] = sock; } - else if (sock != sockets[idx]) { + else if(sock != sockets[idx]) { /* An easy handle with a socket different to previously tracked one, log and fail right away. Known bug #37. */ fprintf(stderr, "Handle %d started on socket %d and moved to %d\n", @@ -103,16 +103,17 @@ int test(char *url) int i, j; int num_handles = 0; enum HandleState state = ReadyForNewHandle; - char* full_url = malloc(strlen(url) + 4 + 1); + size_t urllen = strlen(url) + 4 + 1; + char* full_url = malloc(urllen); start_test_timing(); - if (!full_url) { + if(!full_url) { fprintf(stderr, "Not enough memory for full url\n"); return TEST_ERR_MAJOR_BAD; } - for (i = 0; i < MAX_EASY_HANDLES; ++i) { + for(i = 0; i < MAX_EASY_HANDLES; ++i) { easy[i] = NULL; sockets[i] = CURL_SOCKET_BAD; } @@ -141,14 +142,15 @@ int test(char *url) bool found_new_socket = FALSE; /* Start a new handle if we aren't at the max */ - if (state == ReadyForNewHandle) { + if(state == ReadyForNewHandle) { easy_init(easy[num_handles]); - if (num_handles % 3 == 2) { - sprintf(full_url, "%s0200", url); + if(num_handles % 3 == 2) { + snprintf(full_url, urllen, "%s0200", url); easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_NTLM); - } else { - sprintf(full_url, "%s0100", url); + } + else { + snprintf(full_url, urllen, "%s0100", url); easy_setopt(easy[num_handles], CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } easy_setopt(easy[num_handles], CURLOPT_FRESH_CONNECT, 1L); @@ -181,34 +183,34 @@ int test(char *url) /* At this point, maxfd is guaranteed to be greater or equal than -1. */ /* Any socket which is new in fdread is associated with the new handle */ - for (i = 0; i <= maxfd; ++i) { + for(i = 0; i <= maxfd; ++i) { bool socket_exists = FALSE; curl_socket_t curfd = (curl_socket_t)i; - if (!FD_ISSET(curfd, &fdread)) { + if(!FD_ISSET(curfd, &fdread)) { continue; } /* Check if this socket was already detected for an earlier handle (or for this handle, num_handles-1, in the callback */ - for (j = 0; j < num_handles; ++j) { - if (sockets[j] == curfd) { + for(j = 0; j < num_handles; ++j) { + if(sockets[j] == curfd) { socket_exists = TRUE; break; } } - if (socket_exists) { + if(socket_exists) { continue; } - if (found_new_socket || state != NeedSocketForNewHandle) { + if(found_new_socket || state != NeedSocketForNewHandle) { fprintf(stderr, "Unexpected new socket\n"); res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } /* Now we know the socket is for the most recent handle, num_handles-1 */ - if (sockets[num_handles-1] != CURL_SOCKET_BAD) { + if(sockets[num_handles-1] != CURL_SOCKET_BAD) { /* A socket for this handle was already detected in the callback; if it matched socket_exists should be true and we would never get here */ assert(curfd != sockets[num_handles-1]); @@ -224,7 +226,7 @@ int test(char *url) } } - if (state == NeedSocketForNewHandle) { + if(state == NeedSocketForNewHandle) { if(maxfd != -1 && !found_new_socket) { fprintf(stderr, "Warning: socket did not open immediately for new " "handle (trying again)\n"); diff --git a/tests/libtest/test.h b/tests/libtest/test.h index f724e4279..9fd33aa72 100644 --- a/tests/libtest/test.h +++ b/tests/libtest/test.h @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,15 +40,13 @@ # include "select.h" #endif -#define _MPRINTF_REPLACE -#include <curl/mprintf.h> - +#include "curl_printf.h" #define test_setopt(A,B,C) \ - if((res = curl_easy_setopt((A),(B),(C))) != CURLE_OK) goto test_cleanup + if((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) goto test_cleanup #define test_multi_setopt(A,B,C) \ - if((res = curl_multi_setopt((A),(B),(C))) != CURLE_OK) goto test_cleanup + if((res = curl_multi_setopt((A), (B), (C))) != CURLE_OK) goto test_cleanup extern char *libtest_arg2; /* set by first.c to the argv[2] or NULL */ extern char *libtest_arg3; /* set by first.c to the argv[3] or NULL */ @@ -114,7 +112,7 @@ extern int unitfail; ** label 'test_cleanup' is performed. ** ** Every easy_* and multi_* macros have a res_easy_* and res_multi_* macro -** counterpart that operates in tha same way with the exception that no +** counterpart that operates in the same way with the exception that no ** jump takes place in case of failure. res_easy_* and res_multi_* macros ** should be immediately followed by checking if 'res' variable has been ** set. @@ -134,16 +132,16 @@ extern int unitfail; } WHILE_FALSE #define res_easy_init(A) \ - exe_easy_init((A),(__FILE__),(__LINE__)) + exe_easy_init((A), (__FILE__), (__LINE__)) #define chk_easy_init(A,Y,Z) do { \ - exe_easy_init((A),(Y),(Z)); \ + exe_easy_init((A), (Y), (Z)); \ if(res) \ goto test_cleanup; \ } WHILE_FALSE #define easy_init(A) \ - chk_easy_init((A),(__FILE__),(__LINE__)) + chk_easy_init((A), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ @@ -155,70 +153,70 @@ extern int unitfail; } WHILE_FALSE #define res_multi_init(A) \ - exe_multi_init((A),(__FILE__),(__LINE__)) + exe_multi_init((A), (__FILE__), (__LINE__)) #define chk_multi_init(A,Y,Z) do { \ - exe_multi_init((A),(Y),(Z)); \ + exe_multi_init((A), (Y), (Z)); \ if(res) \ goto test_cleanup; \ } WHILE_FALSE #define multi_init(A) \ - chk_multi_init((A),(__FILE__),(__LINE__)) + chk_multi_init((A), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ -#define exe_easy_setopt(A,B,C,Y,Z) do { \ - CURLcode ec; \ - if((ec = curl_easy_setopt((A),(B),(C))) != CURLE_OK) { \ - fprintf(stderr, "%s:%d curl_easy_setopt() failed, " \ - "with code %d (%s)\n", \ - (Y), (Z), (int)ec, curl_easy_strerror(ec)); \ - res = (int)ec; \ - } \ +#define exe_easy_setopt(A,B,C,Y,Z) do { \ + CURLcode ec; \ + if((ec = curl_easy_setopt((A), (B), (C))) != CURLE_OK) { \ + fprintf(stderr, "%s:%d curl_easy_setopt() failed, " \ + "with code %d (%s)\n", \ + (Y), (Z), (int)ec, curl_easy_strerror(ec)); \ + res = (int)ec; \ + } \ } WHILE_FALSE -#define res_easy_setopt(A,B,C) \ - exe_easy_setopt((A),(B),(C),(__FILE__),(__LINE__)) +#define res_easy_setopt(A, B, C) \ + exe_easy_setopt((A), (B), (C), (__FILE__), (__LINE__)) -#define chk_easy_setopt(A,B,C,Y,Z) do { \ - exe_easy_setopt((A),(B),(C),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ +#define chk_easy_setopt(A, B, C, Y, Z) do { \ + exe_easy_setopt((A), (B), (C), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ } WHILE_FALSE -#define easy_setopt(A,B,C) \ - chk_easy_setopt((A),(B),(C),(__FILE__),(__LINE__)) +#define easy_setopt(A, B, C) \ + chk_easy_setopt((A), (B), (C), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ -#define exe_multi_setopt(A,B,C,Y,Z) do { \ - CURLMcode ec; \ - if((ec = curl_multi_setopt((A),(B),(C))) != CURLM_OK) { \ - fprintf(stderr, "%s:%d curl_multi_setopt() failed, " \ - "with code %d (%s)\n", \ - (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ - } \ +#define exe_multi_setopt(A, B, C, Y, Z) do { \ + CURLMcode ec; \ + if((ec = curl_multi_setopt((A), (B), (C))) != CURLM_OK) { \ + fprintf(stderr, "%s:%d curl_multi_setopt() failed, " \ + "with code %d (%s)\n", \ + (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ + res = (int)ec; \ + } \ } WHILE_FALSE #define res_multi_setopt(A,B,C) \ - exe_multi_setopt((A),(B),(C),(__FILE__),(__LINE__)) + exe_multi_setopt((A), (B), (C), (__FILE__), (__LINE__)) -#define chk_multi_setopt(A,B,C,Y,Z) do { \ - exe_multi_setopt((A),(B),(C),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ +#define chk_multi_setopt(A,B,C,Y,Z) do { \ + exe_multi_setopt((A), (B), (C), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ } WHILE_FALSE #define multi_setopt(A,B,C) \ - chk_multi_setopt((A),(B),(C),(__FILE__),(__LINE__)) + chk_multi_setopt((A), (B), (C), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ #define exe_multi_add_handle(A,B,Y,Z) do { \ CURLMcode ec; \ - if((ec = curl_multi_add_handle((A),(B))) != CURLM_OK) { \ + if((ec = curl_multi_add_handle((A), (B))) != CURLM_OK) { \ fprintf(stderr, "%s:%d curl_multi_add_handle() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ @@ -226,23 +224,23 @@ extern int unitfail; } \ } WHILE_FALSE -#define res_multi_add_handle(A,B) \ - exe_multi_add_handle((A),(B),(__FILE__),(__LINE__)) +#define res_multi_add_handle(A, B) \ + exe_multi_add_handle((A), (B), (__FILE__), (__LINE__)) -#define chk_multi_add_handle(A,B,Y,Z) do { \ - exe_multi_add_handle((A),(B),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ +#define chk_multi_add_handle(A, B, Y, Z) do { \ + exe_multi_add_handle((A), (B), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ } WHILE_FALSE -#define multi_add_handle(A,B) \ - chk_multi_add_handle((A),(B),(__FILE__),(__LINE__)) +#define multi_add_handle(A, B) \ + chk_multi_add_handle((A), (B), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ #define exe_multi_remove_handle(A,B,Y,Z) do { \ CURLMcode ec; \ - if((ec = curl_multi_remove_handle((A),(B))) != CURLM_OK) { \ + if((ec = curl_multi_remove_handle((A), (B))) != CURLM_OK) { \ fprintf(stderr, "%s:%d curl_multi_remove_handle() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ @@ -250,24 +248,24 @@ extern int unitfail; } \ } WHILE_FALSE -#define res_multi_remove_handle(A,B) \ - exe_multi_remove_handle((A),(B),(__FILE__),(__LINE__)) +#define res_multi_remove_handle(A, B) \ + exe_multi_remove_handle((A), (B), (__FILE__), (__LINE__)) -#define chk_multi_remove_handle(A,B,Y,Z) do { \ - exe_multi_remove_handle((A),(B),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ +#define chk_multi_remove_handle(A, B, Y, Z) do { \ + exe_multi_remove_handle((A), (B), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ } WHILE_FALSE -#define multi_remove_handle(A,B) \ - chk_multi_remove_handle((A),(B),(__FILE__),(__LINE__)) +#define multi_remove_handle(A, B) \ + chk_multi_remove_handle((A), (B), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ #define exe_multi_perform(A,B,Y,Z) do { \ CURLMcode ec; \ - if((ec = curl_multi_perform((A),(B))) != CURLM_OK) { \ + if((ec = curl_multi_perform((A), (B))) != CURLM_OK) { \ fprintf(stderr, "%s:%d curl_multi_perform() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ @@ -281,53 +279,53 @@ extern int unitfail; } \ } WHILE_FALSE -#define res_multi_perform(A,B) \ - exe_multi_perform((A),(B),(__FILE__),(__LINE__)) +#define res_multi_perform(A, B) \ + exe_multi_perform((A), (B), (__FILE__), (__LINE__)) -#define chk_multi_perform(A,B,Y,Z) do { \ - exe_multi_perform((A),(B),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ +#define chk_multi_perform(A, B, Y, Z) do { \ + exe_multi_perform((A), (B), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ } WHILE_FALSE #define multi_perform(A,B) \ - chk_multi_perform((A),(B),(__FILE__),(__LINE__)) + chk_multi_perform((A), (B), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ -#define exe_multi_fdset(A,B,C,D,E,Y,Z) do { \ - CURLMcode ec; \ - if((ec = curl_multi_fdset((A),(B),(C),(D),(E))) != CURLM_OK) { \ - fprintf(stderr, "%s:%d curl_multi_fdset() failed, " \ - "with code %d (%s)\n", \ - (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ - res = (int)ec; \ - } \ - else if(*((E)) < -1) { \ - fprintf(stderr, "%s:%d curl_multi_fdset() succeeded, " \ - "but returned invalid max_fd value (%d)\n", \ - (Y), (Z), (int)*((E))); \ - res = TEST_ERR_NUM_HANDLES; \ - } \ +#define exe_multi_fdset(A, B, C, D, E, Y, Z) do { \ + CURLMcode ec; \ + if((ec = curl_multi_fdset((A), (B), (C), (D), (E))) != CURLM_OK) { \ + fprintf(stderr, "%s:%d curl_multi_fdset() failed, " \ + "with code %d (%s)\n", \ + (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ + res = (int)ec; \ + } \ + else if(*((E)) < -1) { \ + fprintf(stderr, "%s:%d curl_multi_fdset() succeeded, " \ + "but returned invalid max_fd value (%d)\n", \ + (Y), (Z), (int)*((E))); \ + res = TEST_ERR_NUM_HANDLES; \ + } \ } WHILE_FALSE -#define res_multi_fdset(A,B,C,D,E) \ - exe_multi_fdset((A),(B),(C),(D),(E),(__FILE__),(__LINE__)) +#define res_multi_fdset(A, B, C, D, E) \ + exe_multi_fdset((A), (B), (C), (D), (E), (__FILE__), (__LINE__)) -#define chk_multi_fdset(A,B,C,D,E,Y,Z) do { \ - exe_multi_fdset((A),(B),(C),(D),(E),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ -} WHILE_FALSE +#define chk_multi_fdset(A, B, C, D, E, Y, Z) do { \ + exe_multi_fdset((A), (B), (C), (D), (E), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ + } WHILE_FALSE -#define multi_fdset(A,B,C,D,E) \ - chk_multi_fdset((A),(B),(C),(D),(E),(__FILE__),(__LINE__)) +#define multi_fdset(A, B, C, D, E) \ + chk_multi_fdset((A), (B), (C), (D), (E), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ #define exe_multi_timeout(A,B,Y,Z) do { \ CURLMcode ec; \ - if((ec = curl_multi_timeout((A),(B))) != CURLM_OK) { \ + if((ec = curl_multi_timeout((A), (B))) != CURLM_OK) { \ fprintf(stderr, "%s:%d curl_multi_timeout() failed, " \ "with code %d (%s)\n", \ (Y), (Z), (int)ec, curl_multi_strerror(ec)); \ @@ -341,42 +339,42 @@ extern int unitfail; } \ } WHILE_FALSE -#define res_multi_timeout(A,B) \ - exe_multi_timeout((A),(B),(__FILE__),(__LINE__)) +#define res_multi_timeout(A, B) \ + exe_multi_timeout((A), (B), (__FILE__), (__LINE__)) -#define chk_multi_timeout(A,B,Y,Z) do { \ - exe_multi_timeout((A),(B),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ -} WHILE_FALSE +#define chk_multi_timeout(A, B, Y, Z) do { \ + exe_multi_timeout((A), (B), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ + } WHILE_FALSE -#define multi_timeout(A,B) \ - chk_multi_timeout((A),(B),(__FILE__),(__LINE__)) +#define multi_timeout(A, B) \ + chk_multi_timeout((A), (B), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ -#define exe_select_test(A,B,C,D,E,Y,Z) do { \ - int ec; \ - if(select_wrapper((A),(B),(C),(D),(E)) == -1 ) { \ - ec = SOCKERRNO; \ - fprintf(stderr, "%s:%d select() failed, with " \ - "errno %d (%s)\n", \ - (Y), (Z), ec, strerror(ec)); \ - res = TEST_ERR_SELECT; \ - } \ -} WHILE_FALSE - -#define res_select_test(A,B,C,D,E) \ - exe_select_test((A),(B),(C),(D),(E),(__FILE__),(__LINE__)) - -#define chk_select_test(A,B,C,D,E,Y,Z) do { \ - exe_select_test((A),(B),(C),(D),(E),(Y),(Z)); \ - if(res) \ - goto test_cleanup; \ -} WHILE_FALSE - -#define select_test(A,B,C,D,E) \ - chk_select_test((A),(B),(C),(D),(E),(__FILE__),(__LINE__)) +#define exe_select_test(A, B, C, D, E, Y, Z) do { \ + int ec; \ + if(select_wrapper((A), (B), (C), (D), (E)) == -1) { \ + ec = SOCKERRNO; \ + fprintf(stderr, "%s:%d select() failed, with " \ + "errno %d (%s)\n", \ + (Y), (Z), ec, strerror(ec)); \ + res = TEST_ERR_SELECT; \ + } \ + } WHILE_FALSE + +#define res_select_test(A, B, C, D, E) \ + exe_select_test((A), (B), (C), (D), (E), (__FILE__), (__LINE__)) + +#define chk_select_test(A, B, C, D, E, Y, Z) do { \ + exe_select_test((A), (B), (C), (D), (E), (Y), (Z)); \ + if(res) \ + goto test_cleanup; \ + } WHILE_FALSE + +#define select_test(A, B, C, D, E) \ + chk_select_test((A), (B), (C), (D), (E), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ @@ -393,16 +391,16 @@ extern int unitfail; } WHILE_FALSE #define res_test_timedout() \ - exe_test_timedout((__FILE__),(__LINE__)) + exe_test_timedout((__FILE__), (__LINE__)) -#define chk_test_timedout(Y,Z) do { \ - exe_test_timedout(Y,Z); \ - if(res) \ - goto test_cleanup; \ -} WHILE_FALSE +#define chk_test_timedout(Y, Z) do { \ + exe_test_timedout(Y, Z); \ + if(res) \ + goto test_cleanup; \ + } WHILE_FALSE #define abort_on_test_timeout() \ - chk_test_timedout((__FILE__),(__LINE__)) + chk_test_timedout((__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ @@ -417,18 +415,18 @@ extern int unitfail; } WHILE_FALSE #define res_global_init(A) \ - exe_global_init((A),(__FILE__),(__LINE__)) + exe_global_init((A), (__FILE__), (__LINE__)) -#define chk_global_init(A,Y,Z) do { \ - exe_global_init((A),(Y),(Z)); \ - if(res) \ - return res; \ -} WHILE_FALSE +#define chk_global_init(A, Y, Z) do { \ + exe_global_init((A), (Y), (Z)); \ + if(res) \ + return res; \ + } WHILE_FALSE /* global_init() is different than other macros. In case of failure it 'return's instead of going to 'test_cleanup'. */ #define global_init(A) \ - chk_global_init((A),(__FILE__),(__LINE__)) + chk_global_init((A), (__FILE__), (__LINE__)) /* ---------------------------------------------------------------- */ diff --git a/tests/libtest/testutil.c b/tests/libtest/testutil.c index 2ff06b19d..b9c43de04 100644 --- a/tests/libtest/testutil.c +++ b/tests/libtest/testutil.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -20,7 +20,7 @@ * ***************************************************************************/ #include "curl_setup.h" - +#include <curl/curl.h> #include "testutil.h" #include "memdebug.h" diff --git a/tests/manpage-scan.pl b/tests/manpage-scan.pl new file mode 100644 index 000000000..fc6e1e3f0 --- /dev/null +++ b/tests/manpage-scan.pl @@ -0,0 +1,287 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# Scan symbols-in-version (which is verified to be correct by test 1119), then +# verify that each option mention in there that should have its own man page +# actually does. +# +# In addition, make sure that every current option to curl_easy_setopt, +# curl_easy_getinfo and curl_multi_setopt are also mentioned in their +# corresponding main (index) man page. +# +# src/tool_getparam.c lists all options curl can parse +# docs/curl.1 documents all command line options +# src/tool_help.c outputs all options with curl -h +# - make sure they're all in sync +# +# Output all deviances to stderr. + +use strict; +use warnings; + +# we may get the dir root pointed out +my $root=$ARGV[0] || "."; +my $syms = "$root/docs/libcurl/symbols-in-versions"; +my $curlh = "$root/include/curl/curl.h"; +my $errors=0; + +# the prepopulated alias list is the CURLINFO_* defines that are used for the +# debug function callback and the fact that they use the same prefix as the +# curl_easy_getinfo options was a mistake. +my %alias = ( + 'CURLINFO_DATA_IN' => 'none', + 'CURLINFO_DATA_OUT' => 'none', + 'CURLINFO_END' => 'none', + 'CURLINFO_HEADER_IN' => 'none', + 'CURLINFO_HEADER_OUT' => 'none', + 'CURLINFO_LASTONE' => 'none', + 'CURLINFO_NONE' => 'none', + 'CURLINFO_SSL_DATA_IN' => 'none', + 'CURLINFO_SSL_DATA_OUT' => 'none', + 'CURLINFO_TEXT' => 'none' + ); + +sub scanmanpage { + my ($file, @words) = @_; + + open(M, "<$file"); + my @m = <M>; + close(M); + + foreach my $m (@words) { + + my @g = grep(/^\.IP $m/, @m); + if(!$g[0]) { + print STDERR "Missing mention of $m in $file\n"; + $errors++; + } + } +} + +# check for define alises +open(R, "<$curlh") || + die "no curl.h"; +while(<R>) { + if(/^\#define (CURL(OPT|INFO|MOPT)_\w+) (.*)/) { + $alias{$1}=$3; + } +} +close(R); + +my @curlopt; +my @curlinfo; +my @curlmopt; +open(R, "<$syms") || + die "no input file"; +while(<R>) { + chomp; + my $l= $_; + if($l =~ /(CURL(OPT|INFO|MOPT)_\w+) *([0-9.]*) *([0-9.-]*) *([0-9.]*)/) { + my ($opt, $type, $add, $dep, $rem) = ($1, $2, $3, $4, $5); + + if($alias{$opt}) { + #print "$opt => $alias{$opt}\n"; + } + elsif($rem) { + # $opt was removed in $rem + # so don't check for that + } + else { + if($type eq "OPT") { + push @curlopt, $opt, + } + elsif($type eq "INFO") { + push @curlinfo, $opt, + } + elsif($type eq "MOPT") { + push @curlmopt, $opt, + } + if(! -f "$root/docs/libcurl/opts/$opt.3") { + print STDERR "Missing $opt.3\n"; + $errors++; + } + } + } +} +close(R); + +scanmanpage("$root/docs/libcurl/curl_easy_setopt.3", @curlopt); +scanmanpage("$root/docs/libcurl/curl_easy_getinfo.3", @curlinfo); +scanmanpage("$root/docs/libcurl/curl_multi_setopt.3", @curlmopt); + +# using this hash array, we can whitelist specific options +my %opts = ( + # pretend these --no options exists in tool_getparam.c + '--no-alpn' => 1, + '--no-npn' => 1, + '-N, --no-buffer' => 1, + '--no-sessionid' => 1, + '--no-keepalive' => 1, + + # pretend these options without -no exist in curl.1 and tool_help.c + '--alpn' => 6, + '--npn' => 6, + '--eprt' => 6, + '--epsv' => 6, + '--keepalive' => 6, + '-N, --buffer' => 6, + '--sessionid' => 6, + + # deprecated options do not need to be in curl -h output + '--krb4' => 4, + '--ftp-ssl' => 4, + '--ftp-ssl-reqd' => 4, + + # for tests and debug only, can remain hidden + '--test-event' => 6, + '--wdebug' => 6, + ); + + +######################################################################### +# parse the curl code that parses the command line arguments! +open(R, "<$root/src/tool_getparam.c") || + die "no input file"; +my $list; +my @getparam; # store all parsed parameters + +while(<R>) { + chomp; + my $l= $_; + if(/struct LongShort aliases/) { + $list=1; + } + elsif($list) { + if( /^ \{([^,]*), *([^ ]*)/) { + my ($s, $l)=($1, $2); + my $sh; + my $lo; + my $title; + if($l =~ /\"(.*)\"/) { + # long option + $lo = $1; + $title="--$lo"; + } + if($s =~ /\"(.)\"/) { + # a short option + $sh = $1; + $title="-$sh, $title"; + } + push @getparam, $title; + $opts{$title} |= 1; + } + } +} +close(R); + +######################################################################### +# parse the curl.1 man page, extract all documented command line options +open(R, "<$root/docs/curl.1") || + die "no input file"; +my @manpage; # store all parsed parameters +while(<R>) { + chomp; + my $l= $_; + if(/^\.IP \"(-[^\"]*)\"/) { + my $str = $1; + my $combo; + if($str =~ /^-(.), --([a-z0-9.-]*)/) { + # figure out the -short, --long combo + $combo = "-$1, --$2"; + } + elsif($str =~ /^--([a-z0-9.-]*)/) { + # figure out the --long name + $combo = "--$1"; + } + if($combo) { + push @manpage, $combo; + $opts{$combo} |= 2; + } + } +} +close(R); + + +######################################################################### +# parse the curl code that outputs the curl -h list +open(R, "<$root/src/tool_help.c") || + die "no input file"; +my @toolhelp; # store all parsed parameters +while(<R>) { + chomp; + my $l= $_; + if(/^ \" *(.*)/) { + my $str=$1; + my $combo; + if($str =~ /^-(.), --([a-z0-9.-]*)/) { + # figure out the -short, --long combo + $combo = "-$1, --$2"; + } + elsif($str =~ /^--([a-z0-9.-]*)/) { + # figure out the --long name + $combo = "--$1"; + } + if($combo) { + push @toolhelp, $combo; + $opts{$combo} |= 4; + } + + } +} +close(R); + +# +# Now we have three arrays with options to cross-reference. + +foreach my $o (keys %opts) { + my $where = $opts{$o}; + + if($where != 7) { + # this is not in all three places + $errors++; + my $exists; + my $missing; + if($where & 1) { + $exists=" tool_getparam.c"; + } + else { + $missing=" tool_getparam.c"; + } + if($where & 2) { + $exists.= " curl.1"; + } + else { + $missing.= " curl.1"; + } + if($where & 4) { + $exists .= " tool_help.c"; + } + else { + $missing .= " tool_help.c"; + } + + print STDERR "$o is not in$missing (but in$exists)\n"; + } +} + +exit $errors; diff --git a/tests/nroff-scan.pl b/tests/nroff-scan.pl new file mode 100644 index 000000000..393068cd3 --- /dev/null +++ b/tests/nroff-scan.pl @@ -0,0 +1,104 @@ +#!/usr/bin/env perl +#*************************************************************************** +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2016, Daniel Stenberg, <daniel@haxx.se>, et al. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### +# +# scan nroff pages to find basic syntactic problems such as unbalanced \f +# codes or references to non-existing curl man pages. + +my $docsroot = $ARGV[0]; + +if(!$docsroot || ($docsroot eq "-g")) { + print "Usage: nroff-scan.pl <docs root dir> [nroff files]\n"; + exit; +} + + +shift @ARGV; + +my @f = @ARGV; + +my %manp; + +sub manpresent { + my ($man) = @_; + if($manp{$man}) { + return 1; + } + elsif(-r "$docsroot/$man" || + -r "$docsroot/libcurl/$man" || + -r "$docsroot/libcurl/opts/$man") { + $manp{$man}=1; + return 1; + } + return 0; +} + +sub file { + my ($f) = @_; + open(F, "<$f") || + die "no file"; + my $line = 1; + while(<F>) { + chomp; + my $l = $_; + while($l =~ s/\\f(.)([^ ]*)\\f(.)//) { + my ($pre, $str, $post)=($1, $2, $3); + if($post ne "P") { + print STDERR "error: $f:$line: missing \\fP after $str\n"; + $errors++; + } + if($str =~ /((libcurl|curl)([^ ]*))\(3\)/i) { + my $man = "$1.3"; + if(!manpresent($man)) { + print STDERR "error: $f:$line: refering to non-existing man page $man\n"; + $errors++; + } + if($pre ne "I") { + print STDERR "error: $f:$line: use \\fI before $str\n"; + $errors++; + } + } + } + if($l =~ /(curl([^ ]*)\(3\))/i) { + print STDERR "error: $f:$line: non-referencing $1\n"; + $errors++; + } + if($l =~ /^\.BR (.*)/) { + my $i= $1; + while($i =~ s/((lib|)curl([^ ]*)) *\"\(3\)(,|) *\" *//i ) { + my $man = "$1.3"; + if(!manpresent($man)) { + print STDERR "error: $f:$line: refering to non-existing man page $man\n"; + $errors++; + } + } + } + $line++; + } + close(F); +} + +foreach my $f (@f) { + file($f); +} + +exit $errors?1:0; diff --git a/tests/pathhelp.pm b/tests/pathhelp.pm new file mode 100644 index 000000000..391ef6c25 --- /dev/null +++ b/tests/pathhelp.pm @@ -0,0 +1,761 @@ +########################################################################### +# _ _ ____ _ +# Project ___| | | | _ \| | +# / __| | | | |_) | | +# | (__| |_| | _ <| |___ +# \___|\___/|_| \_\_____| +# +# Copyright (C) 2016, Evgeny Grin (Karlson2k), <k2k@narod.ru>. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at https://curl.haxx.se/docs/copyright.html. +# +# You may opt to use, copy, modify, merge, publish, distribute and/or sell +# copies of the Software, and permit persons to whom the Software is +# furnished to do so, under the terms of the COPYING file. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +########################################################################### + +# This Perl package helps with path transforming when running cURL tests on +# Win32 platform with Msys or Cygwin. +# Three main functions 'sys_native_abs_path', 'sys_native_path' and +# 'build_sys_abs_path' autodetect format of given pathnames. Following formats +# are supported: +# (1) /some/path - absolute path in Unix-style +# (2) D:/some/path - absolute path in Win32-style +# (3) some/path - relative path +# (4) D:some/path - path relative to current directory on Win32 drive (paths +# like 'D:' are treated as 'D:./') (*) +# (5) \some/path - path from root directory on current Win32 drive (*) +# All forward '/' and back '\' slashes are treated identically except leading +# slash in forms (1) and (5). +# Forward slashes are simpler processed in Perl, do not require extra escaping +# for shell (unlike back slashes) and accepted by Win32 native programs, so +# all functions return paths with only forward slashes except +# 'sys_native_path' which returns paths with first forward slash for form (5). +# All returned paths don't contain any duplicated slashes, only single slashes +# are used as directory separators on output. +# On non-Windows platforms functions acts as transparent wrappers for similar +# Perl's functions or return unmodified string (depending on functionality), +# so all functions can be unconditionally used on all platforms. +# +# (*) CAUTION! Forms (4) and (5) are not recommended to use as they can be +# interpreted incorrectly in Perl and Msys/Cygwin environment have low +# control on Win32 current drive and Win32 current path on specific drive. + + +package pathhelp; +use strict; +use warnings; +use Cwd 'abs_path'; + +BEGIN { + require Exporter; + + our @ISA = qw(Exporter); + + our @EXPORT = qw( + sys_native_abs_path + sys_native_path + ); + + our @EXPORT_OK = qw( + build_sys_abs_path + sys_native_current_path + normalize_path + os_is_win + $use_cygpath + should_use_cygpath + drives_mounted_on_cygdrive + ); +} + + +####################################################################### +# Block for cached static variables +# +{ + # Cached static variable, Perl 5.0-compatible. + my $is_win = $^O eq 'MSWin32' + || $^O eq 'cygwin' + || $^O eq 'msys'; + + # Returns boolean true if OS is any form of Windows. + sub os_is_win { + return $is_win; + } + + # Cached static variable, Perl 5.0-compatible. + my $cygdrive_present; + + # Returns boolean true if Win32 drives mounted with '/cygdrive/' prefix. + sub drives_mounted_on_cygdrive { + return $cygdrive_present if defined $cygdrive_present; + $cygdrive_present = ((-e '/cygdrive/') && (-d '/cygdrive/')) ? 1 : 0; + return $cygdrive_present; + } +} + +our $use_cygpath; # Only for Win32: + # undef - autodetect + # 1 - use cygpath + # 0 - do not use cygpath + +# Returns boolean true if 'cygpath' utility should be used for path conversion. +sub should_use_cygpath { + unless (os_is_win()) { + $use_cygpath = 0; + return 0; + } + return $use_cygpath if defined $use_cygpath; + + $use_cygpath = (qx{cygpath -u '.\\' 2>/dev/null} eq "./\n" && $? == 0); + + return $use_cygpath; +} + +####################################################################### +# Performs path "normalization": all slashes converted to forward +# slashes (except leading slash), all duplicated slashes are replaced +# with single slashes, all relative directories ('./' and '../') are +# resolved if possible. +# Path processed as string, directories are not checked for presence so +# path for not yet existing directory can be "normalized". +# +sub normalize_path; + +####################################################################### +# Returns current working directory in Win32 format on Windows. +# +sub sys_native_current_path { + return Cwd::getcwd() unless os_is_win(); + + my $cur_dir; + if($^O eq 'msys') { + # MSys shell has built-in command. + chomp($cur_dir = `bash -c 'pwd -W'`); + if($? != 0) { + warn "Can't determine Win32 current directory.\n"; + return undef; + } + # Add final slash if required. + $cur_dir .= '/' if length($cur_dir) > 3; + } + else { + # Do not use 'cygpath' - it falsely succeed on paths like '/cygdrive'. + $cur_dir = `cmd "/c;" echo %__CD__%`; + if($? != 0 || substr($cur_dir, 0, 1) eq '%') { + warn "Can't determine Win32 current directory.\n"; + return undef; + } + # Remove both '\r' and '\n'. + $cur_dir =~ s{\n|\r}{}g; + + # Replace back slashes with forward slashes. + $cur_dir =~ s{\\}{/}g; + } + return $cur_dir; +} + +####################################################################### +# Returns Win32 current drive letter with colon. +# +sub get_win32_current_drive { + # Notice parameter "/c;" - it's required to turn off Msys's + # transformation of '/c' and compatible with Cygwin. + my $drive_letter = `cmd "/c;" echo %__CD__:~0,2%`; + if($? != 0 || substr($drive_letter, 1, 1) ne ':') { + warn "Can't determine current Win32 drive letter.\n"; + return undef; + } + + return substr($drive_letter, 0, 2); +} + +# Internal function. Converts path by using Msys's built-in transformation. +# Returned path may contain duplicated and back slashes. +sub do_msys_transform; + +# Internal function. Gets two parameters: first parameter must be single +# drive letter ('c'), second optional parameter is path relative to drive's +# current working directory. Returns Win32 absolute normalized path. +sub get_abs_path_on_win32_drive; + +# Internal function. Tries to find or guess Win32 version of given +# absolute Unix-style path. Other types of paths are not supported. +# Returned paths contain only single forward slashes (no back and +# duplicated slashes). +# Last resort. Used only when other transformations are not available. +sub do_dumb_guessed_transform; + +####################################################################### +# Converts given path to system native format, i.e. to Win32 format on +# Windows platform. Relative paths converted to relative, absolute +# paths converted to absolute. +# +sub sys_native_path { + my ($path) = @_; + + # Return untouched on non-Windows platforms. + return $path unless (os_is_win()); + + # Do not process empty path. + return $path if ($path eq ''); + + if($path =~ s{^([a-zA-Z]):$}{\u$1:}) { + # Path is single drive with colon. (C:) + # This type of paths is not processed correctly by 'cygpath'. + # WARNING! + # Be careful, this relative path can be accidentally transformed + # into wrong absolute path by adding to it some '/dirname' with + # slash at font. + return $path; + } + elsif($path =~ m{^\\} || $path =~ m{^[a-zA-Z]:[^/\\]}) { + # Path is a directory or filename on Win32 current drive or relative + # path on current directory on specific Win32 drive. + # ('\path' or 'D:path') + # First type of paths is not processed by Msys transformation and + # resolved to absolute path by 'cygpath'. + # Second type is not processed by Msys transformation and may be + # incorrectly processed by 'cygpath' (for paths like 'D:..\../.\') + + my $first_char = ucfirst(substr($path, 0, 1)); + + # Replace any back and duplicated slashes with single forward slashes. + $path =~ s{[\\/]+}{/}g; + + # Convert leading slash back to forward slash to indicate + # directory on Win32 current drive or capitalize drive letter. + substr($path, 0, 1) = $first_char; + return $path; + } + elsif(should_use_cygpath()) { + # 'cygpath' is available - use it. + + # Remove leading duplicated forward and back slashes, as they may + # prevent transforming and may be not processed. + $path =~ s{^([\\/])[\\/]+}{$1}g; + + my $has_final_slash = ($path =~ m{[/\\]$}); + + # Use 'cygpath', '-m' means Win32 path with forward slashes. + chomp($path = `cygpath -m '$path'`); + if ($? != 0) { + warn "Can't convert path by \"cygpath\".\n"; + return undef; + } + + # 'cygpath' may remove last slash for existing directories. + $path .= '/' if($has_final_slash); + + # Remove any duplicated forward slashes (added by 'cygpath' for root + # directories) + $path =~ s{//+}{/}g; + + return $path; + } + elsif($^O eq 'msys') { + # Msys transforms automatically path to Windows native form in staring + # program parameters if program is not Msys-based. + + $path = do_msys_transform($path); + return undef unless defined $path; + + # Capitalize drive letter for Win32 paths. + $path =~ s{^([a-z]:)}{\u$1}; + + # Replace any back and duplicated slashes with single forward slashes. + $path =~ s{[\\/]+}{/}g; + return $path; + } + elsif($path =~ s{^([a-zA-Z]):[/\\]}{\u$1:/}) { + # Path is already in Win32 form. ('C:\path') + + # Replace any back and duplicated slashes with single forward slashes. + $path =~ s{[\\/]+}{/}g; + return $path; + } + elsif($path !~ m{^/}) { + # Path is in relative form. ('path/name', './path' or '../path') + + # Replace any back and duplicated slashes with single forward slashes. + $path =~ s{[\\/]+}{/}g; + return $path; + } + + # OS is Windows, but not Msys, path is absolute, path is not in Win32 + # form and 'cygpath' is not available. + return do_dumb_guessed_transform($path); +} + +####################################################################### +# Converts given path to system native absolute path, i.e. to Win32 +# absolute format on Windows platform. Both relative and absolute +# formats are supported for input. +# +sub sys_native_abs_path { + my ($path) = @_; + + unless(os_is_win()) { + # Convert path to absolute form. + $path = Cwd::abs_path($path); + + # Do not process further on non-Windows platforms. + return $path; + } + + if($path =~ m{^([a-zA-Z]):($|[^/\\].*$)}) { + # Path is single drive with colon or relative path on Win32 drive. + # ('C:' or 'C:path') + # This kind of relative path is not processed correctly by 'cygpath'. + # Get specified drive letter + return get_abs_path_on_win32_drive($1, $2); + } + elsif($path eq '') { + # Path is empty string. Return current directory. + # Empty string processed correctly by 'cygpath'. + + return sys_native_current_path(); + } + elsif(should_use_cygpath()) { + # 'cygpath' is available - use it. + + my $has_final_slash = ($path =~ m{[\\/]$}); + + # Remove leading duplicated forward and back slashes, as they may + # prevent transforming and may be not processed. + $path =~ s{^([\\/])[\\/]+}{$1}g; + + print "Inter result: \"$path\"\n"; + # Use 'cygpath', '-m' means Win32 path with forward slashes, + # '-a' means absolute path + chomp($path = `cygpath -m -a '$path'`); + if($? != 0) { + warn "Can't resolve path by usung \"cygpath\".\n"; + return undef; + } + + # 'cygpath' may remove last slash for existing directories. + $path .= '/' if($has_final_slash); + + # Remove any duplicated forward slashes (added by 'cygpath' for root + # directories) + $path =~ s{//+}{/}g; + + return $path + } + elsif($path =~ s{^([a-zA-Z]):[/\\]}{\u$1:/}) { + # Path is already in Win32 form. ('C:\path') + + # Replace any possible back slashes with forward slashes, + # remove any duplicated slashes, resolve relative dirs. + return normalize_path($path); + } + elsif(substr($path, 0, 1) eq '\\' ) { + # Path is directory or filename on Win32 current drive. ('\Windows') + + my $w32drive = get_win32_current_drive(); + return undef unless defined $w32drive; + + # Combine drive and path. + # Replace any possible back slashes with forward slashes, + # remove any duplicated slashes, resolve relative dirs. + return normalize_path($w32drive . $path); + } + + unless (substr($path, 0, 1) eq '/') { + # Path is in relative form. Resolve relative directories in Unix form + # *BEFORE* converting to Win32 form otherwise paths like + # '../../../cygdrive/c/windows' will not be resolved. + my $cur_dir = `pwd -L`; + if($? != 0) { + warn "Can't determine current working directory.\n"; + return undef; + } + chomp($cur_dir); + + $path = $cur_dir . '/' . $path; + } + + # Resolve relative dirs. + $path = normalize_path($path); + return undef unless defined $path; + + if($^O eq 'msys') { + # Msys transforms automatically path to Windows native form in staring + # program parameters if program is not Msys-based. + $path = do_msys_transform($path); + return undef unless defined $path; + + # Replace any back and duplicated slashes with single forward slashes. + $path =~ s{[\\/]+}{/}g; + return $path; + } + # OS is Windows, but not Msys, path is absolute, path is not in Win32 + # form and 'cygpath' is not available. + + return do_dumb_guessed_transform($path); +} + +# Internal function. Converts given Unix-style absolute path to Win32 format. +sub simple_transform_win32_to_unix; + +####################################################################### +# Converts given path to build system format absolute path, i.e. to +# Msys/Cygwin Unix-style absolute format on Windows platform. Both +# relative and absolute formats are supported for input. +# +sub build_sys_abs_path { + my ($path) = @_; + + unless(os_is_win()) { + # Convert path to absolute form. + $path = Cwd::abs_path($path); + + # Do not process further on non-Windows platforms. + return $path; + } + + if($path =~ m{^([a-zA-Z]):($|[^/\\].*$)}) { + # Path is single drive with colon or relative path on Win32 drive. + # ('C:' or 'C:path') + # This kind of relative path is not processed correctly by 'cygpath'. + # Get specified drive letter + + # Resolve relative dirs in Win32-style path or paths like 'D:/../c/' + # will be resolved incorrectly. + # Replace any possible back slashes with forward slashes, + # remove any duplicated slashes. + $path = get_abs_path_on_win32_drive($1, $2); + return undef unless defined $path; + + return simple_transform_win32_to_unix($path); + } + elsif($path eq '') { + # Path is empty string. Return current directory. + # Empty string processed correctly by 'cygpath'. + + chomp($path = `pwd -L`); + if($? != 0) { + warn "Can't determine Unix-style current working directory.\n"; + return undef; + } + + # Add final slash if not at root dir. + $path .= '/' if length($path) > 2; + return $path; + } + elsif(should_use_cygpath()) { + # 'cygpath' is avalable - use it. + + my $has_final_slash = ($path =~ m{[\\/]$}); + + # Resolve relative directories, as they may be not resolved for + # Unix-style paths. + # Remove duplicated slashes, as they may be not processed. + $path = normalize_path($path); + return undef unless defined $path; + + # Use 'cygpath', '-u' means Unix-stile path, + # '-a' means absolute path + chomp($path = `cygpath -u -a '$path'`); + if($? != 0) { + warn "Can't resolve path by usung \"cygpath\".\n"; + return undef; + } + + # 'cygpath' removes last slash if path is root dir on Win32 drive. + # Restore it. + $path .= '/' if($has_final_slash && + substr($path, length($path) - 1, 1) ne '/'); + + return $path + } + elsif($path =~ m{^[a-zA-Z]:[/\\]}) { + # Path is already in Win32 form. ('C:\path') + + # Resolve relative dirs in Win32-style path otherwise paths + # like 'D:/../c/' will be resolved incorrectly. + # Replace any possible back slashes with forward slashes, + # remove any duplicated slashes. + $path = normalize_path($path); + return undef unless defined $path; + + return simple_transform_win32_to_unix($path); + } + elsif(substr($path, 0, 1) eq '\\') { + # Path is directory or filename on Win32 current drive. ('\Windows') + + my $w32drive = get_win32_current_drive(); + return undef unless defined $w32drive; + + # Combine drive and path. + # Resolve relative dirs in Win32-style path or paths like 'D:/../c/' + # will be resolved incorrectly. + # Replace any possible back slashes with forward slashes, + # remove any duplicated slashes. + $path = normalize_path($w32drive . $path); + return undef unless defined $path; + + return simple_transform_win32_to_unix($path); + } + + # Path is not in any Win32 form. + unless (substr($path, 0, 1) eq '/') { + # Path in relative form. Resolve relative directories in Unix form + # *BEFORE* converting to Win32 form otherwise paths like + # '../../../cygdrive/c/windows' will not be resolved. + my $cur_dir = `pwd -L`; + if($? != 0) { + warn "Can't determine current working directory.\n"; + return undef; + } + chomp($cur_dir); + + $path = $cur_dir . '/' . $path; + } + + return normalize_path($path); +} + +####################################################################### +# Performs path "normalization": all slashes converted to forward +# slashes (except leading slash), all duplicated slashes are replaced +# with single slashes, all relative directories ('./' and '../') are +# resolved if possible. +# Path processed as string, directories are not checked for presence so +# path for not yet existing directory can be "normalized". +# +sub normalize_path { + my ($path) = @_; + + # Don't process empty paths. + return $path if $path eq ''; + + unless($path =~ m{(?:^|\\|/)\.{1,2}(?:\\|/|$)}) { + # Speed up processing of simple paths. + my $first_char = substr($path, 0, 1); + $path =~ s{[\\/]+}{/}g; + # Restore starting backslash if any. + substr($path, 0, 1) = $first_char; + return $path; + } + + my @arr; + my $prefix; + my $have_root = 0; + + # Check whether path starts from Win32 drive. ('C:path' or 'C:\path') + if($path =~ m{^([a-zA-Z]:(/|\\)?)(.*$)}) { + $prefix = $1; + $have_root = 1 if defined $2; + # Process path separately from drive letter. + @arr = split(m{\/|\\}, $3); + # Replace backslash with forward slash if required. + substr($prefix, 2, 1) = '/' if $have_root; + } + else { + if($path =~ m{^(\/|\\)}) { + $have_root = 1; + $prefix = $1; + } + else { + $prefix = ''; + } + @arr = split(m{\/|\\}, $path); + } + + my $p = 0; + my @res; + + for my $el (@arr) { + if(length($el) == 0 || $el eq '.') { + next; + } + elsif($el eq '..' && @res > 0 && $res[$#res] ne '..') { + pop @res; + next; + } + push @res, $el; + } + if($have_root && @res > 0 && $res[0] eq '..') { + warn "Error processing path \"$path\": " . + "Parent directory of root directory does not exist!\n"; + return undef; + } + + my $ret = $prefix . join('/', @res); + $ret .= '/' if($path =~ m{\\$|/$} && scalar @res > 0); + + return $ret; +} + +# Internal function. Converts path by using Msys's built-in +# transformation. +sub do_msys_transform { + my ($path) = @_; + return undef if $^O ne 'msys'; + return $path if $path eq ''; + + # Remove leading double forward slashes, as they turn off Msys + # transforming. + $path =~ s{^/[/\\]+}{/}; + + # Msys transforms automatically path to Windows native form in staring + # program parameters if program is not Msys-based. + # Note: already checked that $path is non-empty. + $path = `cmd //c echo '$path'`; + if($? != 0) { + warn "Can't transform path into Win32 form by using Msys" . + "internal transformation.\n"; + return undef; + } + + # Remove double quotes, they are added for paths with spaces, + # remove both '\r' and '\n'. + $path =~ s{^\"|\"$|\"\r|\n|\r}{}g; + + return $path; +} + +# Internal function. Gets two parameters: first parameter must be single +# drive letter ('c'), second optional parameter is path relative to drive's +# current working directory. Returns Win32 absolute normalized path. +sub get_abs_path_on_win32_drive { + my ($drv, $rel_path) = @_; + my $res; + + # Get current directory on specified drive. + # "/c;" is compatible with both Msys and Cygwin. + my $cur_dir_on_drv = `cmd "/c;" echo %=$drv:%`; + if($? != 0) { + warn "Can't determine Win32 current directory on drive $drv:.\n"; + return undef; + } + + if($cur_dir_on_drv =~ m{^[%]}) { + # Current directory on drive is not set, default is + # root directory. + + $res = ucfirst($drv) . ':/'; + } + else { + # Current directory on drive was set. + # Remove both '\r' and '\n'. + $cur_dir_on_drv =~ s{\n|\r}{}g; + + # Append relative path part. + $res = $cur_dir_on_drv . '/'; + } + $res .= $rel_path if defined $rel_path; + + # Replace any possible back slashes with forward slashes, + # remove any duplicated slashes, resolve relative dirs. + return normalize_path($res); +} + +# Internal function. Tries to find or guess Win32 version of given +# absolute Unix-style path. Other types of paths are not supported. +# Returned paths contain only single forward slashes (no back and +# duplicated slashes). +# Last resort. Used only when other transformations are not available. +sub do_dumb_guessed_transform { + my ($path) = @_; + + # Replace any possible back slashes and duplicated forward slashes + # with single forward slashes. + $path =~ s{[/\\]+}{/}g; + + # Empty path is not valid. + return undef if (length($path) == 0); + + # RE to find Win32 drive letter + my $drv_ltr_re = drives_mounted_on_cygdrive() ? + qr{^/cygdrive/([a-zA-Z])($|/.*$)} : + qr{^/([a-zA-Z])($|/.*$)}; + + # Check path whether path is Win32 directly mapped drive and try to + # transform it assuming that drive letter is matched to Win32 drive letter. + if($path =~ m{$drv_ltr_re}) { + return ucfirst($1) . ':/' if(length($2) == 0); + return ucfirst($1) . ':' . $2; + } + + # This may be some custom mapped path. ('/mymount/path') + + # Must check longest possible path component as subdir can be mapped to + # different directory. For example '/usr/bin/' can be mapped to '/bin/' or + # '/bin/' can be mapped to '/usr/bin/'. + my $check_path = $path; + my $path_tail = ''; + do { + if(-d $check_path) { + my $res = + `(cd "$check_path" && cmd /c "echo %__CD__%") 2>/dev/null`; + if($? == 0 && substr($path, 0, 1) ne '%') { + # Remove both '\r' and '\n'. + $res =~ s{\n|\r}{}g; + + # Replace all back slashes with forward slashes. + $res =~ s{\\}{/}g; + + if(length($path_tail) > 0) { + return $res . $path_tail; + } + else { + $res =~ s{/$}{} unless $check_path =~ m{/$}; + return $res; + } + } + } + if($check_path =~ m{(^.*/)([^/]+/*)}) { + $check_path = $1; + $path_tail = $2 . $path_tail; + } + else { + # Shouldn't happens as root '/' directory should always + # be resolvable. + warn "Can't determine Win32 directory for path \"$path\".\n"; + return undef; + } + } while(1); +} + + +# Internal function. Converts given Unix-style absolute path to Win32 format. +sub simple_transform_win32_to_unix { + my ($path) = @_; + + if(should_use_cygpath()) { + # 'cygpath' gives precise result. + my $res; + chomp($res = `cygpath -a -u '$path'`); + if($? != 0) { + warn "Can't determine Unix-style directory for Win32 " . + "directory \"$path\".\n"; + return undef; + } + + # 'cygpath' removes last slash if path is root dir on Win32 drive. + $res .= '/' if(substr($res, length($res) - 1, 1) ne '/' && + $path =~ m{[/\\]$}); + return $res; + } + + # 'cygpath' is not available, use guessed transformation. + unless($path =~ s{^([a-zA-Z]):(?:/|\\)}{/\l$1/}) { + warn "Can't determine Unix-style directory for Win32 " . + "directory \"$path\".\n"; + return undef; + } + + $path = '/cygdrive' . $path if(drives_mounted_on_cygdrive()); + return $path; +} + +1; # End of module diff --git a/tests/runtests.pdf b/tests/runtests.pdf Binary files differindex 43746d400..48b1b20fa 100644 --- a/tests/runtests.pdf +++ b/tests/runtests.pdf diff --git a/tests/runtests.pl b/tests/runtests.pl index f2b73f69d..b8497f9c2 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -105,6 +105,8 @@ use sshhelp qw( sshversioninfo ); +use pathhelp; + require "getpart.pm"; # array functions require "valgrind.pm"; # valgrind report parser require "ftp.pm"; @@ -142,6 +144,7 @@ my $HTTPTLS6PORT; # HTTP TLS (non-stunnel) IPv6 server port my $HTTPPROXYPORT; # HTTP proxy port, when using CONNECT my $HTTPPIPEPORT; # HTTP pipelining port my $HTTPUNIXPATH; # HTTP server Unix domain socket path +my $HTTP2PORT; # HTTP/2 server port my $srcdir = $ENV{'srcdir'} || '.'; my $CURL="../src/curl".exe_ext(); # what curl executable to run on the tests @@ -364,7 +367,7 @@ delete $ENV{'CURL_CA_BUNDLE'} if($ENV{'CURL_CA_BUNDLE'}); # Load serverpidfile hash with pidfile names for all possible servers. # sub init_serverpidfile_hash { - for my $proto (('ftp', 'http', 'imap', 'pop3', 'smtp')) { + for my $proto (('ftp', 'http', 'imap', 'pop3', 'smtp', 'http/2')) { for my $ssl (('', 's')) { for my $ipvnum ((4, 6)) { for my $idnum ((1, 2, 3)) { @@ -384,7 +387,7 @@ sub init_serverpidfile_hash { } } } - for my $proto (('http', 'imap', 'pop3', 'smtp')) { + for my $proto (('http', 'imap', 'pop3', 'smtp', 'http/2')) { for my $ssl (('', 's')) { my $serv = servername_id("$proto$ssl", "unix", 1); my $pidf = server_pidfilename("$proto$ssl", "unix", 1); @@ -1188,6 +1191,63 @@ sub responsiveserver { } ####################################################################### +# start the http2 server +# +sub runhttp2server { + my ($verbose, $port) = @_; + my $server; + my $srvrname; + my $pidfile; + my $logfile; + my $flags = ""; + my $proto="http/2"; + my $ipvnum = 4; + my $idnum = 0; + my $exe = "$perl $srcdir/http2-server.pl"; + my $verbose_flag = "--verbose "; + + $server = servername_id($proto, $ipvnum, $idnum); + + $pidfile = $serverpidfile{$server}; + + # don't retry if the server doesn't work + if ($doesntrun{$pidfile}) { + return (0,0); + } + + my $pid = processexists($pidfile); + if($pid > 0) { + stopserver($server, "$pid"); + } + unlink($pidfile) if(-f $pidfile); + + $srvrname = servername_str($proto, $ipvnum, $idnum); + + $logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum); + + $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; + $flags .= "--port $HTTP2PORT "; + $flags .= $verbose_flag if($debugprotocol); + + my $cmd = "$exe $flags"; + my ($http2pid, $pid2) = startnew($cmd, $pidfile, 15, 0); + + if($http2pid <= 0 || !pidexists($http2pid)) { + # it is NOT alive + logmsg "RUN: failed to start the $srvrname server\n"; + stopserver($server, "$pid2"); + $doesntrun{$pidfile} = 1; + return (0,0); + } + + if($verbose) { + logmsg "RUN: $srvrname server is now running PID $http2pid\n"; + } + + return ($http2pid, $pid2); +} + +####################################################################### # start the http server # sub runhttpserver { @@ -2311,27 +2371,11 @@ sub checksystem { $curl =~ s/^(.*)(libcurl.*)/$1/g; $libcurl = $2; - if($curl =~ /mingw(32|64)/) { - # This is a windows minw32 build, we need to translate the - # given path to the "actual" windows path. The MSYS shell - # has a builtin 'pwd -W' command which converts the path. - $pwd = `sh -c "echo \$(pwd -W)"`; - chomp($pwd); - } - elsif ($curl =~ /win32/) { - # Native Windows builds don't understand the - # output of cygwin's pwd. It will be - # something like /cygdrive/c/<some path>. - # - # Use the cygpath utility to convert the - # working directory to a Windows friendly - # path. The -m option converts to use drive - # letter:, but it uses / instead \. Forward - # slashes (/) are easier for us. We don't - # have to escape them to get them to curl - # through a shell. - chomp($pwd = `cygpath -m $pwd`); - } + if($curl =~ /win32|mingw(32|64)/) { + # This is a Windows MinGW build or native build, we need to use + # Win32-style path. + $pwd = pathhelp::sys_native_current_path(); + } if ($libcurl =~ /winssl/i) { $has_winssl=1; $ssllib="WinSSL"; @@ -2358,6 +2402,7 @@ sub checksystem { } elsif ($libcurl =~ /polarssl/i) { $has_polarssl=1; + $has_sslpinning=1; $ssllib="polarssl"; } elsif ($libcurl =~ /axtls/i) { @@ -2497,6 +2542,8 @@ sub checksystem { if($feat =~ /HTTP2/) { # http2 enabled $has_http2=1; + + push @protocols, 'http/2'; } } # @@ -2690,6 +2737,7 @@ sub subVariables { $$thing =~ s/%HTTPTLSPORT/$HTTPTLSPORT/g; $$thing =~ s/%HTTP6PORT/$HTTP6PORT/g; $$thing =~ s/%HTTPSPORT/$HTTPSPORT/g; + $$thing =~ s/%HTTP2PORT/$HTTP2PORT/g; $$thing =~ s/%HTTPPORT/$HTTPPORT/g; $$thing =~ s/%HTTPPIPEPORT/$HTTPPIPEPORT/g; $$thing =~ s/%PROXYPORT/$HTTPPROXYPORT/g; @@ -2984,7 +3032,7 @@ sub singletest { next; } } - elsif($1 eq "http2") { + elsif($1 eq "http/2") { if($has_http2) { next; } @@ -3792,6 +3840,23 @@ sub singletest { # verify redirected stdout my @actual = loadarray($STDOUT); + # what parts to cut off from stdout + my @stripfile = getpart("verify", "stripfile"); + + foreach my $strip (@stripfile) { + chomp $strip; + my @newgen; + for(@actual) { + eval $strip; + if($_) { + push @newgen, $_; + } + } + # this is to get rid of array entries that vanished (zero + # length) because of replacements + @actual = @newgen; + } + # variable-replace in the stdout we have from the test case file @validstdout = fixarray(@validstdout); @@ -4190,7 +4255,7 @@ sub startservers { for(@what) { my (@whatlist) = split(/\s+/,$_); my $what = lc($whatlist[0]); - $what =~ s/[^a-z0-9-]//g; + $what =~ s/[^a-z0-9\/-]//g; my $certfile; if($what =~ /^(ftp|http|imap|pop3|smtp)s((\d*)(-ipv6|-unix|))$/) { @@ -4276,6 +4341,17 @@ sub startservers { $run{'gopher-ipv6'}="$pid $pid2"; } } + elsif($what eq "http/2") { + if(!$run{'http/2'}) { + ($pid, $pid2) = runhttp2server($verbose, $HTTP2PORT); + if($pid <= 0) { + return "failed starting HTTP/2 server"; + } + logmsg sprintf ("* pid http/2 => %d %d\n", $pid, $pid2) + if($verbose); + $run{'http/2'}="$pid $pid2"; + } + } elsif($what eq "http") { if($torture && $run{'http'} && !responsive_http_server("http", $verbose, 0, $HTTPPORT)) { @@ -5016,6 +5092,7 @@ $HTTPTLSPORT = $base++; # HTTP TLS (non-stunnel) server port $HTTPTLS6PORT = $base++; # HTTP TLS (non-stunnel) IPv6 server port $HTTPPROXYPORT = $base++; # HTTP proxy port, when using CONNECT $HTTPPIPEPORT = $base++; # HTTP pipelining port +$HTTP2PORT = $base++; # HTTP/2 port $HTTPUNIXPATH = 'http.sock'; # HTTP server Unix domain socket path ####################################################################### diff --git a/tests/secureserver.pl b/tests/secureserver.pl index c770fa5a7..3a7443c40 100755 --- a/tests/secureserver.pl +++ b/tests/secureserver.pl @@ -40,6 +40,8 @@ use serverhelp qw( server_logfilename ); +use pathhelp; + my $stunnel = "stunnel"; my $verbose=0; # set to 1 for debugging @@ -229,9 +231,9 @@ if($stunnel_version < 310) { if($stunnel =~ /tstunnel(\.exe)?"?$/) { $tstunnel_windows = 1; - # replace Cygwin and MinGW drives within paths - $capath =~ s/^(\/cygdrive)?\/(\w)\//$2\:\//; - $certfile =~ s/^(\/cygdrive)?\/(\w)\//$2\:\//; + # convert Cygwin/MinGW paths to Win32 format + $capath = pathhelp::sys_native_abs_path($capath); + $certfile = pathhelp::sys_native_abs_path($certfile); } #*************************************************************************** diff --git a/tests/server/Makefile.am b/tests/server/Makefile.am index cc779e644..e274c01ab 100644 --- a/tests/server/Makefile.am +++ b/tests/server/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -62,3 +62,5 @@ include Makefile.inc EXTRA_DIST = base64.pl Makefile.inc CMakeLists.txt +checksrc: + @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c diff --git a/tests/server/Makefile.in b/tests/server/Makefile.in index 28306f8d2..77fbc31e0 100644 --- a/tests/server/Makefile.in +++ b/tests/server/Makefile.in @@ -514,7 +514,7 @@ top_srcdir = @top_srcdir@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -2238,6 +2238,9 @@ uninstall-am: .PRECIOUS: Makefile +checksrc: + @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/tests/server/fake_ntlm.c b/tests/server/fake_ntlm.c index 5b4d4fe98..87118b315 100644 --- a/tests/server/fake_ntlm.c +++ b/tests/server/fake_ntlm.c @@ -76,7 +76,7 @@ static char *printable(char *inbuf, size_t inlength) return NULL; if(!inlength) { - sprintf(&outbuf[0], "%s", NOTHING_STR); + snprintf(&outbuf[0], outsize, "%s", NOTHING_STR); return outbuf; } @@ -98,7 +98,7 @@ static char *printable(char *inbuf, size_t inlength) o++; } else { - sprintf(&outbuf[o], HEX_FMT_STR, inbuf[i]); + snprintf(&outbuf[o], outsize - o, HEX_FMT_STR, inbuf[i]); o += HEX_STR_LEN; } @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) (use_cached_creds) ? "yes" : "no"); env = getenv("CURL_NTLM_AUTH_TESTNUM"); - if (env) { + if(env) { char *endptr; long lnum = strtol(env, &endptr, 10); if((endptr != env + strlen(env)) || (lnum < 1L)) { @@ -171,13 +171,14 @@ int main(int argc, char *argv[]) exit(1); } testnum = lnum; - } else { + } + else { logmsg("Test number not specified in CURL_NTLM_AUTH_TESTNUM"); exit(1); } env = getenv("CURL_NTLM_AUTH_SRCDIR"); - if (env) { + if(env) { path = env; } @@ -230,7 +231,8 @@ int main(int argc, char *argv[]) } else { size = 0; - error = getpart(&type1_output, &size, "ntlm_auth_type1", "output", stream); + error = getpart(&type1_output, &size, "ntlm_auth_type1", "output", + stream); fclose(stream); if(error || size == 0) { logmsg("getpart() type 1 output failed with error: %d", error); @@ -251,7 +253,8 @@ int main(int argc, char *argv[]) } else { size = 0; - error = getpart(&type3_output, &size, "ntlm_auth_type3", "output", stream); + error = getpart(&type3_output, &size, "ntlm_auth_type3", "output", + stream); fclose(stream); if(error || size == 0) { logmsg("getpart() type 3 output failed with error: %d", error); diff --git a/tests/server/getpart.c b/tests/server/getpart.c index 0642564eb..1952fbbe5 100644 --- a/tests/server/getpart.c +++ b/tests/server/getpart.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -29,7 +29,7 @@ #include "curlx.h" /* from the private lib dir */ /* just to please curl_base64.h we create a fake struct */ -struct SessionHandle { +struct Curl_easy { int fake; }; @@ -101,7 +101,7 @@ static int readline(char **buffer, size_t *bufsize, FILE *stream) int bytestoread = curlx_uztosi(*bufsize - offset); if(!fgets(*buffer + offset, bytestoread, stream)) - return (offset != 0) ? GPE_OK : GPE_END_OF_FILE ; + return (offset != 0) ? GPE_OK : GPE_END_OF_FILE; length = offset + strlen(*buffer + offset); if(*(*buffer + length - 1) == '\n') diff --git a/tests/server/resolve.c b/tests/server/resolve.c index 8cd0c260d..206245aba 100644 --- a/tests/server/resolve.c +++ b/tests/server/resolve.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) sclose(s); } - if (rc == 0) { + if(rc == 0) { /* getaddrinfo() resolve */ struct addrinfo *ai; struct addrinfo hints; @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) /* Use parenthesis around functions to stop them from being replaced by the macro in memdebug.h */ rc = (getaddrinfo)(host, "80", &hints, &ai); - if (rc == 0) + if(rc == 0) (freeaddrinfo)(ai); } diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index 0838ce2b7..91ef6c62b 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -353,15 +353,15 @@ static int ProcessRequest(struct httprequest *req) char *ptr; if(!strcmp(prot_str, "HTTP")) { - req->protocol = RPROT_HTTP; + req->protocol = RPROT_HTTP; } else if(!strcmp(prot_str, "RTSP")) { - req->protocol = RPROT_RTSP; + req->protocol = RPROT_RTSP; } else { - req->protocol = RPROT_NONE; - logmsg("got unknown protocol %s", prot_str); - return 1; + req->protocol = RPROT_NONE; + logmsg("got unknown protocol %s", prot_str); + return 1; } req->prot_version = prot_major*10 + prot_minor; @@ -375,10 +375,10 @@ static int ProcessRequest(struct httprequest *req) char *filename; if((strlen(doc) + strlen(request)) < 200) - sprintf(logbuf, "Got request: %s %s %s/%d.%d", - request, doc, prot_str, prot_major, prot_minor); + snprintf(logbuf, sizeof(logbuf), "Got request: %s %s %s/%d.%d", + request, doc, prot_str, prot_major, prot_minor); else - sprintf(logbuf, "Got a *HUGE* request %s/%d.%d", + snprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request %s/%d.%d", prot_str, prot_major, prot_minor); logmsg("%s", logbuf); @@ -409,8 +409,8 @@ static int ProcessRequest(struct httprequest *req) else req->partno = 0; - sprintf(logbuf, "Requested test number %ld part %ld", - req->testno, req->partno); + snprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld", + req->testno, req->partno); logmsg("%s", logbuf); filename = test2file(req->testno); @@ -488,7 +488,7 @@ static int ProcessRequest(struct httprequest *req) rtp_scratch[0] = '$'; /* The channel follows and is one byte */ - SET_RTP_PKT_CHN(rtp_scratch ,rtp_channel); + SET_RTP_PKT_CHN(rtp_scratch, rtp_channel); /* Length follows and is a two byte short in network order */ SET_RTP_PKT_LEN(rtp_scratch, rtp_size); @@ -501,14 +501,18 @@ static int ProcessRequest(struct httprequest *req) if(req->rtp_buffer == NULL) { req->rtp_buffer = rtp_scratch; req->rtp_buffersize = rtp_size + 4; - } else { - req->rtp_buffer = realloc(req->rtp_buffer, req->rtp_buffersize + rtp_size + 4); - memcpy(req->rtp_buffer + req->rtp_buffersize, rtp_scratch, rtp_size + 4); + } + else { + req->rtp_buffer = realloc(req->rtp_buffer, + req->rtp_buffersize + + rtp_size + 4); + memcpy(req->rtp_buffer + req->rtp_buffersize, rtp_scratch, + rtp_size + 4); req->rtp_buffersize += rtp_size + 4; free(rtp_scratch); } - logmsg("rtp_buffersize is %zu, rtp_size is %d.", req->rtp_buffersize, rtp_size); - + logmsg("rtp_buffersize is %zu, rtp_size is %d.", + req->rtp_buffersize, rtp_size); } } else { @@ -529,8 +533,9 @@ static int ProcessRequest(struct httprequest *req) else { if(sscanf(req->reqbuf, "CONNECT %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d", doc, &prot_major, &prot_minor) == 3) { - sprintf(logbuf, "Received a CONNECT %s HTTP/%d.%d request", - doc, prot_major, prot_minor); + snprintf(logbuf, sizeof(logbuf), + "Received a CONNECT %s HTTP/%d.%d request", + doc, prot_major, prot_minor); logmsg("%s", logbuf); if(req->prot_version == 10) @@ -662,10 +667,11 @@ static int ProcessRequest(struct httprequest *req) req->ntlm = TRUE; /* NTLM found */ logmsg("Received NTLM type-1, sending back data %ld", req->partno); } - else if((req->partno >= 1000) && strstr(req->reqbuf, "Authorization: Basic")) { - /* If the client is passing this Basic-header and the part number is already - >=1000, we add 1 to the part number. This allows simple Basic authentication - negotiation to work in the test suite. */ + else if((req->partno >= 1000) && + strstr(req->reqbuf, "Authorization: Basic")) { + /* If the client is passing this Basic-header and the part number is + already >=1000, we add 1 to the part number. This allows simple Basic + authentication negotiation to work in the test suite. */ req->partno += 1; logmsg("Received Basic request, sending back data %ld", req->partno); } @@ -723,15 +729,15 @@ static void storerequest(char *reqbuf, size_t totalsize) size_t writeleft; FILE *dump; - if (reqbuf == NULL) + if(reqbuf == NULL) return; - if (totalsize == 0) + if(totalsize == 0) return; do { dump = fopen(REQUEST_DUMP, "ab"); - } while ((dump == NULL) && ((error = errno) == EINTR)); - if (dump == NULL) { + } while((dump == NULL) && ((error = errno) == EINTR)); + if(dump == NULL) { logmsg("Error opening file %s error: %d %s", REQUEST_DUMP, error, strerror(error)); logmsg("Failed to write request input to " REQUEST_DUMP); @@ -746,7 +752,7 @@ static void storerequest(char *reqbuf, size_t totalsize) goto storerequest_cleanup; if(written > 0) writeleft -= written; - } while ((writeleft > 0) && ((error = errno) == EINTR)); + } while((writeleft > 0) && ((error = errno) == EINTR)); if(writeleft == 0) logmsg("Wrote request (%zu bytes) input to " REQUEST_DUMP, totalsize); @@ -815,9 +821,9 @@ static int get_request(curl_socket_t sock, struct httprequest *req) } else { if(req->skip) - /* we are instructed to not read the entire thing, so we make sure to only - read what we're supposed to and NOT read the enire thing the client - wants to send! */ + /* we are instructed to not read the entire thing, so we make sure to + only read what we're supposed to and NOT read the enire thing the + client wants to send! */ got = sread(sock, reqbuf + req->offset, req->cl); else got = sread(sock, reqbuf + req->offset, REQBUFSIZ-1 - req->offset); @@ -908,7 +914,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) case RCMD_STREAM: #define STREAMTHIS "a string to stream 01234567890\n" count = strlen(STREAMTHIS); - for (;;) { + for(;;) { written = swrite(sock, STREAMTHIS, count); if(got_exit_signal) return -1; @@ -937,10 +943,12 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) case DOCNUMBER_WERULEZ: /* we got a "friends?" question, reply back that we sure are */ logmsg("Identifying ourselves as friends"); - sprintf(msgbuf, "RTSP_SERVER WE ROOLZ: %ld\r\n", (long)getpid()); + snprintf(msgbuf, sizeof(msgbuf), "RTSP_SERVER WE ROOLZ: %ld\r\n", + (long)getpid()); msglen = strlen(msgbuf); - sprintf(weare, "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s", - msglen, msgbuf); + snprintf(weare, sizeof(weare), + "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s", + msglen, msgbuf); buffer = weare; break; case DOCNUMBER_INTERNAL: @@ -958,9 +966,10 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) default: logmsg("Replying to with a 404"); if(req->protocol == RPROT_HTTP) { - buffer = doc404_HTTP; - } else { - buffer = doc404_RTSP; + buffer = doc404_HTTP; + } + else { + buffer = doc404_RTSP; } break; } @@ -971,7 +980,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) char *filename = test2file(req->testno); if(0 != req->partno) - sprintf(partbuf, "data%ld", req->partno); + snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno); stream=fopen(filename, "rb"); if(!stream) { @@ -1058,7 +1067,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) if(num > 200) num = 200; written = swrite(sock, buffer, num); - if (written < 0) { + if(written < 0) { sendfailure = TRUE; break; } @@ -1082,7 +1091,8 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) size_t num = count; if(num > 200) num = 200; - written = swrite(sock, req->rtp_buffer + (req->rtp_buffersize - count), num); + written = swrite(sock, req->rtp_buffer + (req->rtp_buffersize - count), + num); if(written < 0) { sendfailure = TRUE; break; @@ -1108,7 +1118,8 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) } if(sendfailure) { - logmsg("Sending response failed. Only (%zu bytes) of (%zu bytes) were sent", + logmsg("Sending response failed. Only (%zu bytes) of " + "(%zu bytes) were sent", responsesize-count, responsesize); free(ptr); free(cmd); @@ -1119,7 +1130,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) responsesize); free(ptr); - if(cmdsize > 0 ) { + if(cmdsize > 0) { char command[32]; int quarters; int num; @@ -1278,7 +1289,7 @@ int main(int argc, char *argv[]) } flag = 1; - if (0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&flag, sizeof(flag))) { error = SOCKERRNO; logmsg("setsockopt(SO_REUSEADDR) failed with error: (%d) %s", @@ -1331,12 +1342,12 @@ int main(int argc, char *argv[]) if(!wrotepidfile) goto server_cleanup; - for (;;) { + for(;;) { msgsock = accept(sock, NULL, NULL); if(got_exit_signal) break; - if (CURL_SOCKET_BAD == msgsock) { + if(CURL_SOCKET_BAD == msgsock) { error = SOCKERRNO; logmsg("MAJOR ERROR: accept() failed with error: (%d) %s", error, strerror(error)); @@ -1360,7 +1371,7 @@ int main(int argc, char *argv[]) * response in many small segments to torture the clients more. */ flag = 1; - if (setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY, + if(setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY, (void *)&flag, sizeof(flag)) == -1) { logmsg("====> TCP_NODELAY failed"); } @@ -1424,7 +1435,7 @@ int main(int argc, char *argv[]) clear_advisor_read_lock(SERVERLOGS_LOCK); } - if (req.testno == DOCNUMBER_QUIT) + if(req.testno == DOCNUMBER_QUIT) break; } diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index 2e30f62fd..38aa51e67 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -53,31 +53,34 @@ * * This program is a single-threaded process. * - * This program is intended to be highly portable and as such it must be kept as - * simple as possible, due to this the only signal handling mechanisms used will - * be those of ANSI C, and used only in the most basic form which is good enough - * for the purpose of this program. + * This program is intended to be highly portable and as such it must be kept + * as simple as possible, due to this the only signal handling mechanisms used + * will be those of ANSI C, and used only in the most basic form which is good + * enough for the purpose of this program. * * For the above reason and the specific needs of this program signals SIGHUP, - * SIGPIPE and SIGALRM will be simply ignored on systems where this can be done. - * If possible, signals SIGINT and SIGTERM will be handled by this program as an - * indication to cleanup and finish execution as soon as possible. This will be - * achieved with a single signal handler 'exit_signal_handler' for both signals. + * SIGPIPE and SIGALRM will be simply ignored on systems where this can be + * done. If possible, signals SIGINT and SIGTERM will be handled by this + * program as an indication to cleanup and finish execution as soon as + * possible. This will be achieved with a single signal handler + * 'exit_signal_handler' for both signals. * * The 'exit_signal_handler' upon the first SIGINT or SIGTERM received signal * will just set to one the global var 'got_exit_signal' storing in global var * 'exit_signal' the signal that triggered this change. * * Nothing fancy that could introduce problems is used, the program at certain - * points in its normal flow checks if var 'got_exit_signal' is set and in case - * this is true it just makes its way out of loops and functions in structured - * and well behaved manner to achieve proper program cleanup and termination. + * points in its normal flow checks if var 'got_exit_signal' is set and in + * case this is true it just makes its way out of loops and functions in + * structured and well behaved manner to achieve proper program cleanup and + * termination. * - * Even with the above mechanism implemented it is worthwile to note that other - * signals might still be received, or that there might be systems on which it - * is not possible to trap and ignore some of the above signals. This implies - * that for increased portability and reliability the program must be coded as - * if no signal was being ignored or handled at all. Enjoy it! + * Even with the above mechanism implemented it is worthwile to note that + * other signals might still be received, or that there might be systems on + * which it is not possible to trap and ignore some of the above signals. + * This implies that for increased portability and reliability the program + * must be coded as if no signal was being ignored or handled at all. Enjoy + * it! */ #ifdef HAVE_SIGNAL_H @@ -469,23 +472,28 @@ static void lograw(unsigned char *buffer, ssize_t len) unsigned char *ptr = buffer; char *optr = data; ssize_t width=0; + int left = sizeof(data); for(i=0; i<len; i++) { switch(ptr[i]) { case '\n': - sprintf(optr, "\\n"); + snprintf(optr, left, "\\n"); width += 2; optr += 2; + left-=2; break; case '\r': - sprintf(optr, "\\r"); + snprintf(optr, left, "\\r"); width += 2; optr += 2; + left-=2; break; default: - sprintf(optr, "%c", (ISGRAPH(ptr[i]) || ptr[i]==0x20) ?ptr[i]:'.'); + snprintf(optr, left, "%c", (ISGRAPH(ptr[i]) || + ptr[i]==0x20) ?ptr[i]:'.'); width++; optr++; + left--; break; } @@ -493,6 +501,7 @@ static void lograw(unsigned char *buffer, ssize_t len) logmsg("'%s'", data); width = 0; optr = data; + left = sizeof(data); } } if(width) @@ -1038,7 +1047,7 @@ static bool juggle(curl_socket_t *sockfdp, return FALSE; logmsg("Received %c%c%c%c (on stdin)", - buffer[0], buffer[1], buffer[2], buffer[3] ); + buffer[0], buffer[1], buffer[2], buffer[3]); if(!memcmp("PING", buffer, 4)) { /* send reply on stdout, just proving we are alive */ @@ -1049,7 +1058,7 @@ static bool juggle(curl_socket_t *sockfdp, else if(!memcmp("PORT", buffer, 4)) { /* Question asking us what PORT number we are listening to. Replies to PORT with "IPv[num]/[port]" */ - sprintf((char *)buffer, "%s/%hu\n", ipv_inuse, port); + snprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port); buffer_len = (ssize_t)strlen((char *)buffer); snprintf(data, sizeof(data), "PORT\n%04zx\n", buffer_len); if(!write_stdout(data, 10)) @@ -1071,7 +1080,7 @@ static bool juggle(curl_socket_t *sockfdp, buffer[5] = '\0'; buffer_len = (ssize_t)strtol((char *)buffer, NULL, 16); - if (buffer_len > (ssize_t)sizeof(buffer)) { + if(buffer_len > (ssize_t)sizeof(buffer)) { logmsg("ERROR: Buffer size (%zu bytes) too small for data size " "(%zd bytes)", sizeof(buffer), buffer_len); return FALSE; @@ -1469,7 +1478,7 @@ int main(int argc, char *argv[]) me.sa4.sin_family = AF_INET; me.sa4.sin_port = htons(connectport); me.sa4.sin_addr.s_addr = INADDR_ANY; - if (!addr) + if(!addr) addr = "127.0.0.1"; Curl_inet_pton(AF_INET, addr, &me.sa4.sin_addr); @@ -1480,7 +1489,7 @@ int main(int argc, char *argv[]) memset(&me.sa6, 0, sizeof(me.sa6)); me.sa6.sin6_family = AF_INET6; me.sa6.sin6_port = htons(connectport); - if (!addr) + if(!addr) addr = "::1"; Curl_inet_pton(AF_INET6, addr, &me.sa6.sin6_addr); diff --git a/tests/server/sws.c b/tests/server/sws.c index ffed3838d..27c86e013 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -491,11 +491,11 @@ static int ProcessRequest(struct httprequest *req) /* get the number after it */ if(ptr) { if((strlen(doc) + strlen(request)) < 400) - sprintf(logbuf, "Got request: %s %s HTTP/%d.%d", - request, doc, prot_major, prot_minor); + snprintf(logbuf, sizeof(logbuf), "Got request: %s %s HTTP/%d.%d", + request, doc, prot_major, prot_minor); else - sprintf(logbuf, "Got a *HUGE* request HTTP/%d.%d", - prot_major, prot_minor); + snprintf(logbuf, sizeof(logbuf), "Got a *HUGE* request HTTP/%d.%d", + prot_major, prot_minor); logmsg("%s", logbuf); if(!strncmp("/verifiedserver", ptr, 15)) { @@ -527,8 +527,8 @@ static int ProcessRequest(struct httprequest *req) if(req->testno) { - sprintf(logbuf, "Requested test number %ld part %ld", - req->testno, req->partno); + snprintf(logbuf, sizeof(logbuf), "Requested test number %ld part %ld", + req->testno, req->partno); logmsg("%s", logbuf); /* find and parse <servercmd> for this test */ @@ -548,8 +548,9 @@ static int ProcessRequest(struct httprequest *req) char *portp = NULL; unsigned long part=0; - sprintf(logbuf, "Received a CONNECT %s HTTP/%d.%d request", - doc, prot_major, prot_minor); + snprintf(logbuf, sizeof(logbuf), + "Received a CONNECT %s HTTP/%d.%d request", + doc, prot_major, prot_minor); logmsg("%s", logbuf); req->connect_request = TRUE; @@ -571,7 +572,7 @@ static int ProcessRequest(struct httprequest *req) } if(*p != ']') logmsg("Invalid CONNECT IPv6 address format"); - else if (*(p+1) != ':') + else if(*(p+1) != ':') logmsg("Invalid CONNECT IPv6 port format"); else portp = p+1; @@ -618,8 +619,9 @@ static int ProcessRequest(struct httprequest *req) else req->partno = 0; - sprintf(logbuf, "Requested test number %ld part %ld (from host name)", - req->testno, req->partno); + snprintf(logbuf, sizeof(logbuf), + "Requested test number %ld part %ld (from host name)", + req->testno, req->partno); logmsg("%s", logbuf); } @@ -668,8 +670,9 @@ static int ProcessRequest(struct httprequest *req) else req->partno = 0; - sprintf(logbuf, "Requested GOPHER test number %ld part %ld", - req->testno, req->partno); + snprintf(logbuf, sizeof(logbuf), + "Requested GOPHER test number %ld part %ld", + req->testno, req->partno); logmsg("%s", logbuf); } } @@ -843,15 +846,15 @@ static void storerequest(char *reqbuf, size_t totalsize) FILE *dump; const char *dumpfile=is_proxy?REQUEST_PROXY_DUMP:REQUEST_DUMP; - if (reqbuf == NULL) + if(reqbuf == NULL) return; - if (totalsize == 0) + if(totalsize == 0) return; do { dump = fopen(dumpfile, "ab"); - } while ((dump == NULL) && ((error = errno) == EINTR)); - if (dump == NULL) { + } while((dump == NULL) && ((error = errno) == EINTR)); + if(dump == NULL) { logmsg("[2] Error opening file %s error: %d %s", dumpfile, error, strerror(error)); logmsg("Failed to write request input "); @@ -866,7 +869,7 @@ static void storerequest(char *reqbuf, size_t totalsize) goto storerequest_cleanup; if(written > 0) writeleft -= written; - } while ((writeleft > 0) && ((error = errno) == EINTR)); + } while((writeleft > 0) && ((error = errno) == EINTR)); if(writeleft == 0) logmsg("Wrote request (%zu bytes) input to %s", totalsize, dumpfile); @@ -968,7 +971,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req) } else if(got < 0) { error = SOCKERRNO; - if (EAGAIN == error || EWOULDBLOCK == error) { + if(EAGAIN == error || EWOULDBLOCK == error) { /* nothing to read at the moment */ return 0; } @@ -1013,7 +1016,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req) reqbuf[req->offset] = '\0'; /* at the end of a request dump it to an external file */ - if (fail || req->done_processing) + if(fail || req->done_processing) storerequest(reqbuf, req->pipelining ? req->checkindex : req->offset); if(got_exit_signal) return -1; @@ -1047,7 +1050,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) case RCMD_STREAM: #define STREAMTHIS "a string to stream 01234567890\n" count = strlen(STREAMTHIS); - for (;;) { + for(;;) { written = swrite(sock, STREAMTHIS, count); if(got_exit_signal) return -1; @@ -1076,13 +1079,14 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) case DOCNUMBER_WERULEZ: /* we got a "friends?" question, reply back that we sure are */ logmsg("Identifying ourselves as friends"); - sprintf(msgbuf, "WE ROOLZ: %ld\r\n", (long)getpid()); + snprintf(msgbuf, sizeof(msgbuf), "WE ROOLZ: %ld\r\n", (long)getpid()); msglen = strlen(msgbuf); if(use_gopher) - sprintf(weare, "%s", msgbuf); + snprintf(weare, sizeof(weare), "%s", msgbuf); else - sprintf(weare, "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s", - msglen, msgbuf); + snprintf(weare, sizeof(weare), + "HTTP/1.1 200 OK\r\nContent-Length: %zu\r\n\r\n%s", + msglen, msgbuf); buffer = weare; break; case DOCNUMBER_404: @@ -1103,9 +1107,9 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) const char *section= req->connect_request?"connect":"data"; if(req->partno) - sprintf(partbuf, "%s%ld", section, req->partno); + snprintf(partbuf, sizeof(partbuf), "%s%ld", section, req->partno); else - sprintf(partbuf, "%s", section); + snprintf(partbuf, sizeof(partbuf), "%s", section); logmsg("Send response test%ld section <%s>", req->testno, partbuf); @@ -1191,7 +1195,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) if(num > 200) num = 200; written = swrite(sock, buffer, num); - if (written < 0) { + if(written < 0) { sendfailure = TRUE; break; } @@ -1228,7 +1232,8 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) } if(sendfailure) { - logmsg("Sending response failed. Only (%zu bytes) of (%zu bytes) were sent", + logmsg("Sending response failed. Only (%zu bytes) of (%zu bytes) " + "were sent", responsesize-count, responsesize); free(ptr); free(cmd); @@ -1239,7 +1244,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req) responsesize, responsedump); free(ptr); - if(cmdsize > 0 ) { + if(cmdsize > 0) { char command[32]; int quarters; int num; @@ -1552,7 +1557,8 @@ static void http_connect(curl_socket_t *infdp, /* connect to the server */ serverfd[DATA] = connect_to(ipaddr, req2.connect_port); if(serverfd[DATA] != CURL_SOCKET_BAD) { - /* secondary tunnel established, now we have two connections */ + /* secondary tunnel established, now we have two + connections */ poll_client_rd[DATA] = TRUE; poll_client_wr[DATA] = TRUE; poll_server_rd[DATA] = TRUE; @@ -1874,7 +1880,7 @@ static int service_connection(curl_socket_t msgsock, struct httprequest *req, while(!req->done_processing) { int rc = get_request(msgsock, req); - if (rc <= 0) { + if(rc <= 0) { /* Nothing further to read now (possibly because the socket was closed */ return rc; } @@ -2153,7 +2159,7 @@ int main(int argc, char *argv[]) /* socket server is not alive, now check if it was actually a socket. * Systems which have Unix sockets will also have lstat */ rc = lstat(unix_socket, &statbuf); - if (0 != rc) { + if(0 != rc) { logmsg("Error binding socket, failed to stat %s: (%d) %s", unix_socket, errno, strerror(errno)); goto sws_cleanup; @@ -2223,8 +2229,8 @@ int main(int argc, char *argv[]) curl_socket_t maxfd = (curl_socket_t)-1; /* Clear out closed sockets */ - for (socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) { - if (CURL_SOCKET_BAD == all_sockets[socket_idx]) { + for(socket_idx = num_sockets - 1; socket_idx >= 1; --socket_idx) { + if(CURL_SOCKET_BAD == all_sockets[socket_idx]) { char* dst = (char *) (all_sockets + socket_idx); char* src = (char *) (all_sockets + socket_idx + 1); char* end = (char *) (all_sockets + num_sockets); @@ -2240,7 +2246,7 @@ int main(int argc, char *argv[]) FD_ZERO(&input); FD_ZERO(&output); - for (socket_idx = 0; socket_idx < num_sockets; ++socket_idx) { + for(socket_idx = 0; socket_idx < num_sockets; ++socket_idx) { /* Listen on all sockets */ FD_SET(all_sockets[socket_idx], &input); if(all_sockets[socket_idx] > maxfd) @@ -2251,7 +2257,7 @@ int main(int argc, char *argv[]) goto sws_cleanup; rc = select((int)maxfd + 1, &input, &output, NULL, &timeout); - if (rc < 0) { + if(rc < 0) { error = SOCKERRNO; logmsg("select() failed with error: (%d) %s", error, strerror(error)); @@ -2261,26 +2267,26 @@ int main(int argc, char *argv[]) if(got_exit_signal) goto sws_cleanup; - if (rc == 0) { + if(rc == 0) { /* Timed out - try again*/ continue; } /* Check if the listening socket is ready to accept */ - if (FD_ISSET(all_sockets[0], &input)) { + if(FD_ISSET(all_sockets[0], &input)) { /* Service all queued connections */ curl_socket_t msgsock; do { msgsock = accept_connection(sock); logmsg("accept_connection %d returned %d", sock, msgsock); - if (CURL_SOCKET_BAD == msgsock) + if(CURL_SOCKET_BAD == msgsock) goto sws_cleanup; - } while (msgsock > 0); + } while(msgsock > 0); } /* Service all connections that are ready */ - for (socket_idx = 1; socket_idx < num_sockets; ++socket_idx) { - if (FD_ISSET(all_sockets[socket_idx], &input)) { + for(socket_idx = 1; socket_idx < num_sockets; ++socket_idx) { + if(FD_ISSET(all_sockets[socket_idx], &input)) { if(got_exit_signal) goto sws_cleanup; @@ -2291,7 +2297,7 @@ int main(int argc, char *argv[]) if(got_exit_signal) goto sws_cleanup; - if (rc < 0) { + if(rc < 0) { logmsg("====> Client disconnect %d", req.connmon); if(req.connmon) { @@ -2315,14 +2321,14 @@ int main(int argc, char *argv[]) if(!serverlogslocked) clear_advisor_read_lock(SERVERLOGS_LOCK); - if (req.testno == DOCNUMBER_QUIT) + if(req.testno == DOCNUMBER_QUIT) goto sws_cleanup; } /* Reset the request, unless we're still in the middle of reading */ - if (rc != 0) + if(rc != 0) init_httprequest(&req); - } while (rc > 0); + } while(rc > 0); } } @@ -2332,7 +2338,7 @@ int main(int argc, char *argv[]) sws_cleanup: - for (socket_idx = 1; socket_idx < num_sockets; ++socket_idx) + for(socket_idx = 1; socket_idx < num_sockets; ++socket_idx) if((all_sockets[socket_idx] != sock) && (all_sockets[socket_idx] != CURL_SOCKET_BAD)) sclose(all_sockets[socket_idx]); diff --git a/tests/server/testpart.c b/tests/server/testpart.c index 86854f645..f3a70c7cf 100644 --- a/tests/server/testpart.c +++ b/tests/server/testpart.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -41,7 +41,7 @@ int main(int argc, char **argv) else { rc = getpart(&part, &partlen, argv[1], argv[2], stdin); if(rc) - return(rc); + return rc; for(i = 0; i < partlen; i++) printf("%c", part[i]); free(part); diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index ffc2496d6..afc0884e0 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -459,7 +459,7 @@ static int readit(struct testcase *test, struct tftphdr **dpp, current = !current; /* "incr" current */ b = &bfs[current]; /* look at new buffer */ - if (b->counter == BF_FREE) /* if it's empty */ + if(b->counter == BF_FREE) /* if it's empty */ read_ahead(test, convert); /* fill it */ *dpp = &b->buf.hdr; /* set caller's ptr */ @@ -468,7 +468,7 @@ static int readit(struct testcase *test, struct tftphdr **dpp, /* * fill the input buffer, doing ascii conversions if requested - * conversions are lf -> cr,lf and cr -> cr, nul + * conversions are lf -> cr, lf and cr -> cr, nul */ static void read_ahead(struct testcase *test, int convert /* if true, convert to ascii */) @@ -480,13 +480,13 @@ static void read_ahead(struct testcase *test, struct tftphdr *dp; b = &bfs[nextone]; /* look at "next" buffer */ - if (b->counter != BF_FREE) /* nop if not free */ + if(b->counter != BF_FREE) /* nop if not free */ return; nextone = !nextone; /* "incr" next buffer ptr */ dp = &b->buf.hdr; - if (convert == 0) { + if(convert == 0) { /* The former file reading code did this: b->counter = read(fileno(file), dp->th_data, SEGSIZE); */ size_t copy_n = MIN(SEGSIZE, test->rcount); @@ -500,9 +500,9 @@ static void read_ahead(struct testcase *test, } p = dp->th_data; - for (i = 0 ; i < SEGSIZE; i++) { - if (newline) { - if (prevchar == '\n') + for(i = 0 ; i < SEGSIZE; i++) { + if(newline) { + if(prevchar == '\n') c = '\n'; /* lf to cr,lf */ else c = '\0'; /* cr to cr,nul */ @@ -516,7 +516,7 @@ static void read_ahead(struct testcase *test, } else break; - if (c == '\n' || c == '\r') { + if(c == '\n' || c == '\r') { prevchar = c; c = '\r'; newline = 1; @@ -535,7 +535,7 @@ static int writeit(struct testcase *test, struct tftphdr * volatile *dpp, { bfs[current].counter = ct; /* set size of data to write */ current = !current; /* switch to other buffer */ - if (bfs[current].counter != BF_FREE) /* if not free */ + if(bfs[current].counter != BF_FREE) /* if not free */ write_behind(test, convert); /* flush it */ bfs[current].counter = BF_ALLOC; /* mark as alloc'd */ *dpp = &bfs[current].buf.hdr; @@ -544,7 +544,7 @@ static int writeit(struct testcase *test, struct tftphdr * volatile *dpp, /* * Output a buffer to a file, converting from netascii if requested. - * CR,NUL -> CR and CR,LF => LF. + * CR, NUL -> CR and CR, LF => LF. * Note spec is undefined if we get CR as last byte of file or a * CR followed by anything else. In this case we leave it alone. */ @@ -559,7 +559,7 @@ static ssize_t write_behind(struct testcase *test, int convert) struct tftphdr *dp; b = &bfs[nextone]; - if (b->counter < -1) /* anything to flush? */ + if(b->counter < -1) /* anything to flush? */ return 0; /* just nop if nothing to do */ if(!test->ofile) { @@ -582,21 +582,21 @@ static ssize_t write_behind(struct testcase *test, int convert) nextone = !nextone; /* incr for next time */ writebuf = dp->th_data; - if (count <= 0) + if(count <= 0) return -1; /* nak logic? */ - if (convert == 0) + if(convert == 0) return write(test->ofile, writebuf, count); p = writebuf; ct = count; - while (ct--) { /* loop over the buffer */ + while(ct--) { /* loop over the buffer */ c = *p++; /* pick up a character */ - if (prevchar == '\r') { /* if prev char was cr */ - if (c == '\n') /* if have cr,lf then just */ + if(prevchar == '\r') { /* if prev char was cr */ + if(c == '\n') /* if have cr,lf then just */ lseek(test->ofile, -1, SEEK_CUR); /* smash lf on top of the cr */ else - if (c == '\0') /* if have cr,nul then */ + if(c == '\0') /* if have cr,nul then */ goto skipit; /* just skip over the putc */ /* else just fall through and allow it */ } @@ -634,13 +634,13 @@ static int synchnet(curl_socket_t f /* socket to flush */) srvr_sockaddr_union_t fromaddr; curl_socklen_t fromaddrlen; - for (;;) { + for(;;) { #if defined(HAVE_IOCTLSOCKET) (void) ioctlsocket(f, FIONREAD, &i); #else (void) ioctl(f, FIONREAD, &i); #endif - if (i) { + if(i) { j++; #ifdef ENABLE_IPV6 if(!use_ipv6) @@ -773,7 +773,7 @@ int main(int argc, char **argv) } flag = 1; - if (0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, + if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&flag, sizeof(flag))) { error = SOCKERRNO; logmsg("setsockopt(SO_REUSEADDR) failed with error: (%d) %s", @@ -816,7 +816,7 @@ int main(int argc, char **argv) logmsg("Running %s version on port UDP/%d", ipv_inuse, (int)port); - for (;;) { + for(;;) { fromlen = sizeof(from); #ifdef ENABLE_IPV6 if(!use_ipv6) @@ -830,7 +830,7 @@ int main(int argc, char **argv) &from.sa, &fromlen); if(got_exit_signal) break; - if (n < 0) { + if(n < 0) { logmsg("recvfrom"); result = 3; break; @@ -876,9 +876,9 @@ int main(int argc, char **argv) tp = &buf.hdr; tp->th_opcode = ntohs(tp->th_opcode); - if (tp->th_opcode == opcode_RRQ || tp->th_opcode == opcode_WRQ) { + if(tp->th_opcode == opcode_RRQ || tp->th_opcode == opcode_WRQ) { memset(&test, 0, sizeof(test)); - if (do_tftp(&test, tp, n) < 0) + if(do_tftp(&test, tp, n) < 0) break; free(test.buffer); } @@ -974,8 +974,8 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size) filename = cp; do { bool endofit = true; - while (cp < &buf.storage[size]) { - if (*cp == '\0') { + while(cp < &buf.storage[size]) { + if(*cp == '\0') { endofit = false; break; } @@ -1008,7 +1008,7 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size) break; } while(1); - if (*cp) { + if(*cp) { nak(EBADOP); fclose(server); return 3; @@ -1017,22 +1017,22 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size) /* store input protocol */ fprintf(server, "filename: %s\n", filename); - for (cp = mode; cp && *cp; cp++) + for(cp = mode; cp && *cp; cp++) if(ISUPPER(*cp)) *cp = (char)tolower((int)*cp); /* store input protocol */ fclose(server); - for (pf = formata; pf->f_mode; pf++) - if (strcmp(pf->f_mode, mode) == 0) + for(pf = formata; pf->f_mode; pf++) + if(strcmp(pf->f_mode, mode) == 0) break; - if (!pf->f_mode) { + if(!pf->f_mode) { nak(EBADOP); return 2; } ecode = validate_access(test, filename, tp->th_opcode); - if (ecode) { + if(ecode) { nak(ecode); return 1; } @@ -1046,7 +1046,7 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size) (const char*)&recvtimeout, sizeof(recvtimeout)); #endif - if (tp->th_opcode == opcode_WRQ) + if(tp->th_opcode == opcode_WRQ) recvtftp(test, pf); else sendtftp(test, pf); @@ -1141,7 +1141,8 @@ static int validate_access(struct testcase *test, if(!strncmp("verifiedserver", filename, 14)) { char weare[128]; - size_t count = sprintf(weare, "WE ROOLZ: %ld\r\n", (long)getpid()); + size_t count = snprintf(weare, sizeof(weare), + "WE ROOLZ: %ld\r\n", (long)getpid()); logmsg("Are-we-friendly question received"); test->buffer = strdup(weare); @@ -1183,7 +1184,7 @@ static int validate_access(struct testcase *test, file = test2file(testno); if(0 != partno) - sprintf(partbuf, "data%ld", partno); + snprintf(partbuf, sizeof(partbuf), "data%ld", partno); if(file) { FILE *stream=fopen(file, "rb"); @@ -1244,7 +1245,7 @@ static void sendtftp(struct testcase *test, struct formats *pf) sap = &ackbuf.hdr; do { size = readit(test, &sdp, pf->f_convert); - if (size < 0) { + if(size < 0) { nak(errno + 100); return; } @@ -1261,12 +1262,12 @@ static void sendtftp(struct testcase *test, struct formats *pf) } send_data: - if (swrite(peer, sdp, size + 4) != size + 4) { + if(swrite(peer, sdp, size + 4) != size + 4) { logmsg("write"); return; } read_ahead(test, pf->f_convert); - for ( ; ; ) { + for(;;) { #ifdef HAVE_ALARM alarm(rexmtval); /* read the ack */ #endif @@ -1276,32 +1277,32 @@ static void sendtftp(struct testcase *test, struct formats *pf) #endif if(got_exit_signal) return; - if (n < 0) { + if(n < 0) { logmsg("read: fail"); return; } sap->th_opcode = ntohs((unsigned short)sap->th_opcode); sap->th_block = ntohs(sap->th_block); - if (sap->th_opcode == opcode_ERROR) { + if(sap->th_opcode == opcode_ERROR) { logmsg("got ERROR"); return; } - if (sap->th_opcode == opcode_ACK) { - if (sap->th_block == sendblock) { + if(sap->th_opcode == opcode_ACK) { + if(sap->th_block == sendblock) { break; } /* Re-synchronize with the other side */ (void) synchnet(peer); - if (sap->th_block == (sendblock-1)) { + if(sap->th_block == (sendblock-1)) { goto send_data; } } } sendblock++; - } while (size == SEGSIZE); + } while(size == SEGSIZE); } /* @@ -1330,12 +1331,12 @@ static void recvtftp(struct testcase *test, struct formats *pf) (void) sigsetjmp(timeoutbuf, 1); #endif send_ack: - if (swrite(peer, &ackbuf.storage[0], 4) != 4) { + if(swrite(peer, &ackbuf.storage[0], 4) != 4) { logmsg("write: fail\n"); goto abort; } write_behind(test, pf->f_convert); - for ( ; ; ) { + for(;;) { #ifdef HAVE_ALARM alarm(rexmtval); #endif @@ -1345,37 +1346,38 @@ send_ack: #endif if(got_exit_signal) goto abort; - if (n < 0) { /* really? */ + if(n < 0) { /* really? */ logmsg("read: fail\n"); goto abort; } rdp->th_opcode = ntohs((unsigned short)rdp->th_opcode); rdp->th_block = ntohs(rdp->th_block); - if (rdp->th_opcode == opcode_ERROR) + if(rdp->th_opcode == opcode_ERROR) goto abort; - if (rdp->th_opcode == opcode_DATA) { - if (rdp->th_block == recvblock) { + if(rdp->th_opcode == opcode_DATA) { + if(rdp->th_block == recvblock) { break; /* normal */ } /* Re-synchronize with the other side */ (void) synchnet(peer); - if (rdp->th_block == (recvblock-1)) + if(rdp->th_block == (recvblock-1)) goto send_ack; /* rexmit */ } } size = writeit(test, &rdp, (int)(n - 4), pf->f_convert); - if (size != (n-4)) { /* ahem */ - if (size < 0) + if(size != (n-4)) { /* ahem */ + if(size < 0) nak(errno + 100); else nak(ENOSPACE); goto abort; } - } while (size == SEGSIZE); + } while(size == SEGSIZE); write_behind(test, pf->f_convert); - rap->th_opcode = htons((unsigned short)opcode_ACK); /* send the "final" ack */ + rap->th_opcode = htons((unsigned short)opcode_ACK); /* send the "final" + ack */ rap->th_block = htons(recvblock); (void) swrite(peer, &ackbuf.storage[0], 4); #if defined(HAVE_ALARM) && defined(SIGALRM) @@ -1389,9 +1391,9 @@ send_ack: #endif if(got_exit_signal) goto abort; - if (n >= 4 && /* if read some data */ - rdp->th_opcode == opcode_DATA && /* and got a data block */ - recvblock == rdp->th_block) { /* then my last ack was lost */ + if(n >= 4 && /* if read some data */ + rdp->th_opcode == opcode_DATA && /* and got a data block */ + recvblock == rdp->th_block) { /* then my last ack was lost */ (void) swrite(peer, &ackbuf.storage[0], 4); /* resend final ack */ } abort: @@ -1411,10 +1413,10 @@ static void nak(int error) tp = &buf.hdr; tp->th_opcode = htons((unsigned short)opcode_ERROR); tp->th_code = htons((unsigned short)error); - for (pe = errmsgs; pe->e_code >= 0; pe++) - if (pe->e_code == error) + for(pe = errmsgs; pe->e_code >= 0; pe++) + if(pe->e_code == error) break; - if (pe->e_code < 0) { + if(pe->e_code < 0) { pe->e_msg = strerror(error - 100); tp->th_code = EUNDEF; /* set 'undef' errorcode */ } @@ -1424,6 +1426,6 @@ static void nak(int error) * report from glibc with FORTIFY_SOURCE */ memcpy(tp->th_msg, pe->e_msg, length + 1); length += 5; - if (swrite(peer, &buf.storage[0], length) != length) + if(swrite(peer, &buf.storage[0], length) != length) logmsg("nak: fail\n"); } diff --git a/tests/server/util.c b/tests/server/util.c index 535554c9b..d99336397 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -77,11 +77,11 @@ char *data_to_hex(char *data, size_t len) if((data[i] >= 0x20) && (data[i] < 0x7f)) *optr++ = *iptr++; else { - sprintf(optr, "%%%02x", *iptr++); + snprintf(optr, 4, "%%%02x", *iptr++); optr+=3; } } - *optr=0; /* in case no sprintf() was used */ + *optr=0; /* in case no sprintf was used */ return buf; } @@ -99,7 +99,7 @@ void logmsg(const char *msg, ...) static time_t epoch_offset; static int known_offset; - if (!serverlogfile) { + if(!serverlogfile) { fprintf(stderr, "Error: serverlogfile not set\n"); return; } @@ -140,11 +140,11 @@ void win32_perror (const char *msg) char buf[512]; DWORD err = SOCKERRNO; - if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, - LANG_NEUTRAL, buf, sizeof(buf), NULL)) + if(!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, + LANG_NEUTRAL, buf, sizeof(buf), NULL)) snprintf(buf, sizeof(buf), "Unknown error %lu (%#lx)", err, err); - if (msg) - fprintf(stderr, "%s: ", msg); + if(msg) + fprintf(stderr, "%s: ", msg); fprintf(stderr, "%s\n", buf); } #endif /* WIN32 */ @@ -159,15 +159,14 @@ void win32_init(void) err = WSAStartup(wVersionRequested, &wsaData); - if (err != 0) { + if(err != 0) { perror("Winsock init failed"); logmsg("Error initialising winsock -- aborting"); exit(1); } - if ( LOBYTE( wsaData.wVersion ) != USE_WINSOCK || - HIBYTE( wsaData.wVersion ) != USE_WINSOCK ) { - + if(LOBYTE(wsaData.wVersion) != USE_WINSOCK || + HIBYTE(wsaData.wVersion) != USE_WINSOCK) { WSACleanup(); perror("Winsock init failed"); logmsg("No suitable winsock.dll found -- aborting"); diff --git a/tests/serverhelp.pm b/tests/serverhelp.pm index 8b2779d15..d6a06508d 100644 --- a/tests/serverhelp.pm +++ b/tests/serverhelp.pm @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -105,7 +105,7 @@ sub servername_str { $proto = uc($proto) if($proto); die "unsupported protocol: '$proto'" unless($proto && - ($proto =~ /^(((FTP|HTTP|IMAP|POP3|SMTP|HTTP-PIPE)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|GOPHER|HTTPTLS))$/)); + ($proto =~ /^(((FTP|HTTP|HTTP\/2|IMAP|POP3|SMTP|HTTP-PIPE)S?)|(TFTP|SFTP|SOCKS|SSH|RTSP|GOPHER|HTTPTLS))$/)); $ipver = (not $ipver) ? 'ipv4' : lc($ipver); die "unsupported IP version: '$ipver'" unless($ipver && @@ -137,6 +137,7 @@ sub servername_canon { my ($proto, $ipver, $idnum) = @_; my $string = lc(servername_str($proto, $ipver, $idnum)); $string =~ tr/-/_/; + $string =~ s/\//_v/; return $string; } diff --git a/tests/sshserver.pl b/tests/sshserver.pl index b0c0229b6..3ebf8e675 100755 --- a/tests/sshserver.pl +++ b/tests/sshserver.pl @@ -74,6 +74,7 @@ use serverhelp qw( server_logfilename ); +use pathhelp; #*************************************************************************** @@ -384,7 +385,7 @@ if((! -e $hstprvkeyf) || (! -s $hstprvkeyf) || #*************************************************************************** -# Convert paths for curl's tests running on Windows using Cygwin OpenSSH +# Convert paths for curl's tests running on Windows with Cygwin/Msys OpenSSH # my $clipubkeyf_config = abs_path("$path/$clipubkeyf"); my $hstprvkeyf_config = abs_path("$path/$hstprvkeyf"); @@ -392,10 +393,10 @@ my $pidfile_config = $pidfile; my $sftpsrv_config = $sftpsrv; if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') { - # convert MinGW drive paths to Cygwin drive paths - $clipubkeyf_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; - $hstprvkeyf_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; - $pidfile_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; + # Ensure to use MinGW/Cygwin paths + $clipubkeyf_config = pathhelp::build_sys_abs_path($clipubkeyf_config); + $hstprvkeyf_config = pathhelp::build_sys_abs_path($hstprvkeyf_config); + $pidfile_config = pathhelp::build_sys_abs_path($pidfile_config); $sftpsrv_config = "internal-sftp"; } @@ -558,7 +559,7 @@ sub sshd_supports_opt { ($sshdid =~ /SunSSH/)) { # ssh daemon supports command line options -t -f and -o $err = grep /((Unsupported)|(Bad configuration)|(Deprecated)) option.*$option/, - qx("$sshd" -t -f $sshdconfig -o $option=$value 2>&1); + qx("$sshd" -t -f $sshdconfig -o "$option=$value" 2>&1); return !$err; } if(($sshdid =~ /OpenSSH/) && ($sshdvernum >= 299)) { @@ -763,9 +764,9 @@ my $identity_config = abs_path("$path/$identity"); my $knownhosts_config = abs_path("$path/$knownhosts"); if ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') { - # convert MinGW drive paths to Cygwin drive paths - $identity_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; - $knownhosts_config =~ s/^\/(\w)\//\/cygdrive\/$1\//; + # Ensure to use MinGW/Cygwin paths + $identity_config = pathhelp::build_sys_abs_path($identity_config); + $knownhosts_config = pathhelp::build_sys_abs_path($knownhosts_config); } diff --git a/tests/testcurl.pdf b/tests/testcurl.pdf Binary files differindex 1ded3850e..4d81d7f33 100644 --- a/tests/testcurl.pdf +++ b/tests/testcurl.pdf diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 33af1ec0e..d4987d69d 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -5,7 +5,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -71,6 +71,9 @@ AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS # Makefile.inc provides neat definitions include Makefile.inc +checksrc: + @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c + if BUILD_UNITTESTS noinst_PROGRAMS = $(UNITPROGS) else diff --git a/tests/unit/Makefile.in b/tests/unit/Makefile.in index e4d694b31..e4ef7852f 100644 --- a/tests/unit/Makefile.in +++ b/tests/unit/Makefile.in @@ -527,7 +527,7 @@ top_srcdir = @top_srcdir@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -1650,6 +1650,11 @@ uninstall-am: .PRECIOUS: Makefile +# Makefile.inc provides neat definitions + +checksrc: + @PERL@ $(top_srcdir)/lib/checksrc.pl $(srcdir)/*.c + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/tests/unit/curlcheck.h b/tests/unit/curlcheck.h index 22f05c188..0660e2bed 100644 --- a/tests/unit/curlcheck.h +++ b/tests/unit/curlcheck.h @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -24,7 +24,7 @@ /* The fail macros mark the current test step as failed, and continue */ #define fail_if(expr, msg) \ if(expr) { \ - fprintf(stderr, "%s:%d Assertion '%s' met: %s\n" , \ + fprintf(stderr, "%s:%d Assertion '%s' met: %s\n", \ __FILE__, __LINE__, #expr, msg); \ unitfail++; \ } @@ -38,10 +38,10 @@ #define verify_memory(dynamic, check, len) \ if(dynamic && memcmp(dynamic, check, len)) { \ - fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \ - __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \ + fprintf(stderr, "%s:%d Memory buffer mismatch size %d. '%s' is not\n", \ + __FILE__, __LINE__, len, hexdump((unsigned char *)check, len)); \ fprintf(stderr, "%s:%d the same as '%s'\n", \ - __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \ + __FILE__, __LINE__, hexdump((unsigned char *)dynamic, len)); \ unitfail++; \ } @@ -57,7 +57,7 @@ /* The abort macros mark the current test step as failed, and exit the test */ #define abort_if(expr, msg) \ if(expr) { \ - fprintf(stderr, "%s:%d Abort assertion '%s' met: %s\n" , \ + fprintf(stderr, "%s:%d Abort assertion '%s' met: %s\n", \ __FILE__, __LINE__, #expr, msg); \ unitfail++; \ goto unit_test_abort; \ @@ -85,10 +85,11 @@ extern int unitfail; #define UNITTEST_START \ int test(char *arg) \ { \ - (void)arg; \ - if (unit_setup()) { \ - fail("unit_setup() failure"); \ - } else { + (void)arg; \ + if(unit_setup()) { \ + fail("unit_setup() failure"); \ + } \ + else { #define UNITTEST_STOP \ goto unit_test_abort; /* avoid warning */ \ diff --git a/tests/unit/unit1300.c b/tests/unit/unit1300.c index 2040f702b..c4d9dd90d 100644 --- a/tests/unit/unit1300.c +++ b/tests/unit/unit1300.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -41,8 +41,8 @@ static CURLcode unit_setup(void) return CURLE_OUT_OF_MEMORY; llist_destination = Curl_llist_alloc(test_curl_llist_dtor); if(!llist_destination) { - Curl_llist_destroy(llist, NULL); - return CURLE_OUT_OF_MEMORY; + Curl_llist_destroy(llist, NULL); + return CURLE_OUT_OF_MEMORY; } return CURLE_OK; diff --git a/tests/unit/unit1301.c b/tests/unit/unit1301.c index a50fc67d6..928076e29 100644 --- a/tests/unit/unit1301.c +++ b/tests/unit/unit1301.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,32 +23,32 @@ #include "strequal.h" -static CURLcode unit_setup( void ) {return CURLE_OK;} -static void unit_stop( void ) {} +static CURLcode unit_setup(void) {return CURLE_OK;} +static void unit_stop(void) {} UNITTEST_START int rc; rc = curl_strequal("iii", "III"); -fail_unless( rc != 0 , "return code should be zero" ); +fail_unless(rc != 0, "return code should be zero"); rc = curl_strequal("iiia", "III"); -fail_unless( rc == 0 , "return code should be zero" ); +fail_unless(rc == 0, "return code should be zero"); rc = curl_strequal("iii", "IIIa"); -fail_unless( rc == 0 , "return code should be zero" ); +fail_unless(rc == 0, "return code should be zero"); rc = curl_strequal("iiiA", "IIIa"); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); rc = curl_strnequal("iii", "III", 3); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); rc = curl_strnequal("iiiABC", "IIIcba", 3); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); rc = curl_strnequal("ii", "II", 3); -fail_unless( rc != 0 , "return code should be non-zero" ); +fail_unless(rc != 0, "return code should be non-zero"); UNITTEST_STOP diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index 165c7081a..8dae5aad1 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,9 +26,9 @@ #include "curl_base64.h" #include "memdebug.h" /* LAST include file */ -static struct SessionHandle *data; +static struct Curl_easy *data; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { data = curl_easy_init(); if(!data) @@ -36,7 +36,7 @@ static CURLcode unit_setup( void ) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { curl_easy_cleanup(data); } @@ -52,50 +52,50 @@ CURLcode rc; rc = Curl_base64_encode(data, "i", 1, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 4, "size should be 4"); -verify_memory( output, "aQ==", 4); +verify_memory(output, "aQ==", 4); Curl_safefree(output); rc = Curl_base64_encode(data, "ii", 2, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 4, "size should be 4"); -verify_memory( output, "aWk=", 4); +verify_memory(output, "aWk=", 4); Curl_safefree(output); rc = Curl_base64_encode(data, "iii", 3, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 4, "size should be 4"); -verify_memory( output, "aWlp", 4); +verify_memory(output, "aWlp", 4); Curl_safefree(output); rc = Curl_base64_encode(data, "iiii", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "aWlpaQ==", 8); +verify_memory(output, "aWlpaQ==", 8); Curl_safefree(output); rc = Curl_base64_encode(data, "\xff\x01\xfe\x02", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "/wH+Ag==", 8); +verify_memory(output, "/wH+Ag==", 8); Curl_safefree(output); rc = Curl_base64url_encode(data, "\xff\x01\xfe\x02", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "_wH-Ag==", 8); +verify_memory(output, "_wH-Ag==", 8); Curl_safefree(output); rc = Curl_base64url_encode(data, "iiii", 4, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "aWlpaQ==", 8); +verify_memory(output, "aWlpaQ==", 8); Curl_safefree(output); /* 0 length makes it do strlen() */ rc = Curl_base64_encode(data, "iiii", 0, &output, &size); fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); fail_unless(size == 8, "size should be 8"); -verify_memory( output, "aWlpaQ==", 8); +verify_memory(output, "aWlpaQ==", 8); Curl_safefree(output); rc = Curl_base64_decode("aWlpaQ==", &decoded, &size); @@ -126,7 +126,8 @@ Curl_safefree(decoded); size = 1; /* not zero */ decoded = &anychar; /* not NULL */ rc = Curl_base64_decode("aQ", &decoded, &size); -fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING"); +fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, + "return code should be CURLE_BAD_CONTENT_ENCODING"); fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); @@ -134,7 +135,8 @@ fail_if(decoded, "returned pointer should be NULL"); size = 1; /* not zero */ decoded = &anychar; /* not NULL */ rc = Curl_base64_decode("a===", &decoded, &size); -fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING"); +fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, + "return code should be CURLE_BAD_CONTENT_ENCODING"); fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); @@ -142,7 +144,8 @@ fail_if(decoded, "returned pointer should be NULL"); size = 1; /* not zero */ decoded = &anychar; /* not NULL */ rc = Curl_base64_decode("a=Q=", &decoded, &size); -fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING"); +fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, + "return code should be CURLE_BAD_CONTENT_ENCODING"); fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); @@ -150,7 +153,8 @@ fail_if(decoded, "returned pointer should be NULL"); size = 1; /* not zero */ decoded = &anychar; /* not NULL */ rc = Curl_base64_decode("a\x1f==", &decoded, &size); -fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING"); +fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, + "return code should be CURLE_BAD_CONTENT_ENCODING"); fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); diff --git a/tests/unit/unit1303.c b/tests/unit/unit1303.c index 70be2a862..a4bd59826 100644 --- a/tests/unit/unit1303.c +++ b/tests/unit/unit1303.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -25,17 +25,17 @@ #include "connect.h" #include "memdebug.h" /* LAST include file */ -static struct SessionHandle *data; +static struct Curl_easy *data; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { data = curl_easy_init(); - if (!data) + if(!data) return CURLE_OUT_OF_MEMORY; return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { curl_easy_cleanup(data); } diff --git a/tests/unit/unit1304.c b/tests/unit/unit1304.c index 8c306e44e..11bba390f 100644 --- a/tests/unit/unit1304.c +++ b/tests/unit/unit1304.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -31,10 +31,10 @@ static CURLcode unit_setup(void) { password = strdup(""); login = strdup(""); - if (!password || !login) { - Curl_safefree(password); - Curl_safefree(login); - return CURLE_OUT_OF_MEMORY; + if(!password || !login) { + Curl_safefree(password); + Curl_safefree(login); + return CURLE_OUT_OF_MEMORY; } return CURLE_OK; } @@ -72,7 +72,8 @@ UNITTEST_START abort_unless(password != NULL, "returned NULL!"); fail_unless(password[0] == 0, "password should not have been changed"); abort_unless(login != NULL, "returned NULL!"); - fail_unless(strncmp(login, "me", 2) == 0, "login should not have been changed"); + fail_unless(strncmp(login, "me", 2) == 0, + "login should not have been changed"); /* * Test a non existent login and host in our netrc file. @@ -85,7 +86,8 @@ UNITTEST_START abort_unless(password != NULL, "returned NULL!"); fail_unless(password[0] == 0, "password should not have been changed"); abort_unless(login != NULL, "returned NULL!"); - fail_unless(strncmp(login, "me", 2) == 0, "login should not have been changed"); + fail_unless(strncmp(login, "me", 2) == 0, + "login should not have been changed"); /* * Test a non existent login (substring of an existing one) in our @@ -99,7 +101,8 @@ UNITTEST_START abort_unless(password != NULL, "returned NULL!"); fail_unless(password[0] == 0, "password should not have been changed"); abort_unless(login != NULL, "returned NULL!"); - fail_unless(strncmp(login, "admi", 4) == 0, "login should not have been changed"); + fail_unless(strncmp(login, "admi", 4) == 0, + "login should not have been changed"); /* * Test a non existent login (superstring of an existing one) @@ -113,7 +116,8 @@ UNITTEST_START abort_unless(password != NULL, "returned NULL!"); fail_unless(password[0] == 0, "password should not have been changed"); abort_unless(login != NULL, "returned NULL!"); - fail_unless(strncmp(login, "adminn", 6) == 0, "login should not have been changed"); + fail_unless(strncmp(login, "adminn", 6) == 0, + "login should not have been changed"); /* * Test for the first existing host in our netrc file diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c index c99435d68..ad270f565 100644 --- a/tests/unit/unit1305.c +++ b/tests/unit/unit1305.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -39,16 +39,16 @@ #include "memdebug.h" /* LAST include file */ -static struct SessionHandle *data; +static struct Curl_easy *data; static struct curl_hash hp; static char *data_key; static struct Curl_dns_entry *data_node; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { int rc; data = curl_easy_init(); - if (!data) + if(!data) return CURLE_OUT_OF_MEMORY; rc = Curl_mk_dnscache(&hp); @@ -60,9 +60,9 @@ static CURLcode unit_setup( void ) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { - if (data_node) { + if(data_node) { Curl_freeaddrinfo(data_node->addr); free(data_node); } @@ -103,15 +103,15 @@ static Curl_addrinfo *fake_ai(void) static CURLcode create_node(void) { data_key = aprintf("%s:%d", "dummy", 0); - if (!data_key) + if(!data_key) return CURLE_OUT_OF_MEMORY; data_node = calloc(1, sizeof(struct Curl_dns_entry)); - if (!data_node) + if(!data_node) return CURLE_OUT_OF_MEMORY; data_node->addr = fake_ai(); - if (!data_node->addr) + if(!data_node->addr) return CURLE_OUT_OF_MEMORY; return CURLE_OK; @@ -124,7 +124,7 @@ UNITTEST_START size_t key_len; /* Test 1305 exits without adding anything to the hash */ - if (strcmp(arg, "1305") != 0) { + if(strcmp(arg, "1305") != 0) { CURLcode rc = create_node(); abort_unless(rc == CURLE_OK, "data node creation failed"); key_len = strlen(data_key); diff --git a/tests/unit/unit1307.c b/tests/unit/unit1307.c index 89f49832f..576462274 100644 --- a/tests/unit/unit1307.c +++ b/tests/unit/unit1307.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -160,7 +160,7 @@ static const struct testcase tests[] = { { "****.txt", ".txt", MATCH }, /* empty string or pattern */ - { "", "", MATCH } , + { "", "", MATCH }, { "", "hello", NOMATCH }, { "file", "", NOMATCH }, { "?", "", NOMATCH }, @@ -208,12 +208,12 @@ static const struct testcase tests[] = { { "", "", MATCH } }; -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { } diff --git a/tests/unit/unit1394.c b/tests/unit/unit1394.c index 3818016dd..667991d1e 100644 --- a/tests/unit/unit1394.c +++ b/tests/unit/unit1394.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -84,12 +84,14 @@ UNITTEST_START "for -E param '%s'\n", p[1], certname, p[0]); fail("assertion failure"); } - } else { + } + else { printf("expected certname '%s' but got NULL " "for -E param '%s'\n", p[1], p[0]); fail("assertion failure"); } - } else { + } + else { if(certname) { printf("expected certname NULL but got '%s' " "for -E param '%s'\n", certname, p[0]); @@ -103,12 +105,14 @@ UNITTEST_START "for -E param '%s'\n", p[2], passphrase, p[0]); fail("assertion failure"); } - } else { + } + else { printf("expected passphrase '%s' but got NULL " "for -E param '%s'\n", p[2], p[0]); fail("assertion failure"); } - } else { + } + else { if(passphrase) { printf("expected passphrase NULL but got '%s' " "for -E param '%s'\n", passphrase, p[0]); diff --git a/tests/unit/unit1396.c b/tests/unit/unit1396.c index 8a78c9502..84a5162dd 100644 --- a/tests/unit/unit1396.c +++ b/tests/unit/unit1396.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -30,7 +30,7 @@ static CURLcode unit_setup(void) static void unit_stop(void) { - if (hnd) + if(hnd) curl_easy_cleanup(hnd); } diff --git a/tests/unit/unit1397.c b/tests/unit/unit1397.c index c05c119db..539433ca0 100644 --- a/tests/unit/unit1397.c +++ b/tests/unit/unit1397.c @@ -1,3 +1,24 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ #include "curlcheck.h" #include "hostcheck.h" /* from the lib dir */ @@ -7,7 +28,7 @@ static CURLcode unit_setup(void) return CURLE_OK; } -static void unit_stop( void ) +static void unit_stop(void) { /* done before shutting down and exiting */ } @@ -19,29 +40,36 @@ UNITTEST_START /* here you start doing things and checking that the results are good */ -fail_unless( Curl_cert_hostcheck("www.example.com", "www.example.com"), "good 1" ); -fail_unless( Curl_cert_hostcheck("*.example.com", "www.example.com"), "good 2" ); -fail_unless( Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"), "good 3" ); -fail_unless( Curl_cert_hostcheck("f*.example.com", "foo.example.com"), "good 4" ); -fail_unless( Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"), "good 5" ); - -fail_if( Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1" ); -fail_if( Curl_cert_hostcheck("*", "www.example.com"), "bad 2" ); -fail_if( Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3" ); -fail_if( Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4" ); -fail_if( Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5" ); -fail_if( Curl_cert_hostcheck("*.com", "example.com"), "bad 6" ); -fail_if( Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7" ); -fail_if( Curl_cert_hostcheck("*.example.", "www.example."), "bad 8" ); -fail_if( Curl_cert_hostcheck("*.example.", "www.example"), "bad 9" ); -fail_if( Curl_cert_hostcheck("", "www"), "bad 10" ); -fail_if( Curl_cert_hostcheck("*", "www"), "bad 11" ); -fail_if( Curl_cert_hostcheck("*.168.0.0", "192.168.0.0"), "bad 12" ); -fail_if( Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13" ); +fail_unless(Curl_cert_hostcheck("www.example.com", "www.example.com"), + "good 1"); +fail_unless(Curl_cert_hostcheck("*.example.com", "www.example.com"), + "good 2"); +fail_unless(Curl_cert_hostcheck("xxx*.example.com", "xxxwww.example.com"), + "good 3"); +fail_unless(Curl_cert_hostcheck("f*.example.com", "foo.example.com"), + "good 4"); +fail_unless(Curl_cert_hostcheck("192.168.0.0", "192.168.0.0"), + "good 5"); + +fail_if(Curl_cert_hostcheck("xxx.example.com", "www.example.com"), "bad 1"); +fail_if(Curl_cert_hostcheck("*", "www.example.com"), "bad 2"); +fail_if(Curl_cert_hostcheck("*.*.com", "www.example.com"), "bad 3"); +fail_if(Curl_cert_hostcheck("*.example.com", "baa.foo.example.com"), "bad 4"); +fail_if(Curl_cert_hostcheck("f*.example.com", "baa.example.com"), "bad 5"); +fail_if(Curl_cert_hostcheck("*.com", "example.com"), "bad 6"); +fail_if(Curl_cert_hostcheck("*fail.com", "example.com"), "bad 7"); +fail_if(Curl_cert_hostcheck("*.example.", "www.example."), "bad 8"); +fail_if(Curl_cert_hostcheck("*.example.", "www.example"), "bad 9"); +fail_if(Curl_cert_hostcheck("", "www"), "bad 10"); +fail_if(Curl_cert_hostcheck("*", "www"), "bad 11"); +fail_if(Curl_cert_hostcheck("*.168.0.0", "192.168.0.0"), "bad 12"); +fail_if(Curl_cert_hostcheck("www.example.com", "192.168.0.0"), "bad 13"); #ifdef ENABLE_IPV6 -fail_if( Curl_cert_hostcheck("*::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619"), "bad 14" ); -fail_unless( Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619", "fe80::3285:a9ff:fe46:b619"), "good 6" ); +fail_if(Curl_cert_hostcheck("*::3285:a9ff:fe46:b619", + "fe80::3285:a9ff:fe46:b619"), "bad 14"); +fail_unless(Curl_cert_hostcheck("fe80::3285:a9ff:fe46:b619", + "fe80::3285:a9ff:fe46:b619"), "good 6"); #endif #endif diff --git a/tests/unit/unit1398.c b/tests/unit/unit1398.c index e9cc6753c..9491c46c5 100644 --- a/tests/unit/unit1398.c +++ b/tests/unit/unit1398.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -23,8 +23,8 @@ #include "curl/mprintf.h" -static CURLcode unit_setup( void ) {return CURLE_OK;} -static void unit_stop( void ) {} +static CURLcode unit_setup(void) {return CURLE_OK;} +static void unit_stop(void) {} UNITTEST_START @@ -38,54 +38,54 @@ char output[24]; /* without a trailing zero */ rc = curl_msnprintf(output, 4, "%.*s", width, buf); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "bug"), "wrong output"); /* with a trailing zero */ rc = curl_msnprintf(output, 4, "%.*s", width, str); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "bug"), "wrong output"); width = 2; /* one byte less */ rc = curl_msnprintf(output, 4, "%.*s", width, buf); -fail_unless( rc == 2 , "return code should be 2" ); +fail_unless(rc == 2, "return code should be 2"); fail_unless(!strcmp(output, "bu"), "wrong output"); /* string with larger precision */ rc = curl_msnprintf(output, 8, "%.8s", str); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "bug"), "wrong output"); /* longer string with precision */ rc = curl_msnprintf(output, 8, "%.3s", "0123456789"); -fail_unless( rc == 3 , "return code should be 3" ); +fail_unless(rc == 3, "return code should be 3"); fail_unless(!strcmp(output, "012"), "wrong output"); /* negative width */ rc = curl_msnprintf(output, 8, "%-8s", str); -fail_unless( rc == 8 , "return code should be 8" ); +fail_unless(rc == 8, "return code should be 8"); fail_unless(!strcmp(output, "bug "), "wrong output"); /* larger width that string length */ rc = curl_msnprintf(output, 8, "%8s", str); -fail_unless( rc == 8 , "return code should be 8" ); +fail_unless(rc == 8, "return code should be 8"); fail_unless(!strcmp(output, " bu"), "wrong output"); /* output a number in a limited output */ rc = curl_msnprintf(output, 4, "%d", 10240); /* TODO: this should return 5 to be POSIX/snprintf compliant! */ -fail_unless( rc == 4 , "return code should be 4" ); +fail_unless(rc == 4, "return code should be 4"); fail_unless(!strcmp(output, "102"), "wrong output"); /* padded strings */ rc = curl_msnprintf(output, 16, "%8s%8s", str, str); -fail_unless( rc == 16 , "return code should be 16" ); +fail_unless(rc == 16, "return code should be 16"); fail_unless(!strcmp(output, " bug bu"), "wrong output"); /* padded numbers */ rc = curl_msnprintf(output, 16, "%8d%8d", 1234, 5678); -fail_unless( rc == 16 , "return code should be 16" ); +fail_unless(rc == 16, "return code should be 16"); fail_unless(!strcmp(output, " 1234 567"), "wrong output"); UNITTEST_STOP diff --git a/tests/unit/unit1600.c b/tests/unit/unit1600.c index 2769e9045..f0f9cc1f4 100644 --- a/tests/unit/unit1600.c +++ b/tests/unit/unit1600.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -39,7 +39,8 @@ static void unit_stop(void) UNITTEST_START -#if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || defined(USE_WIN32_CRYPTO)) +#if defined(USE_NTLM) && (!defined(USE_WINDOWS_SSPI) || \ + defined(USE_WIN32_CRYPTO)) unsigned char output[21]; unsigned char *testp = output; Curl_ntlm_core_mk_nt_hash(easy, "1", output); @@ -54,6 +55,7 @@ UNITTEST_START "\x39\xaf\x87\xa6\x75\x0a\x7a\x00\xba\xa0" "\xd3\x4f\x04\x9e\xc1\xd0\x00\x00\x00\x00\x00", 21); +/* !checksrc! disable LONGLINE 2 */ Curl_ntlm_core_mk_nt_hash(easy, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", output); verify_memory(testp, diff --git a/tests/unit/unit1601.c b/tests/unit/unit1601.c index 91c850c9e..a6120e1c2 100644 --- a/tests/unit/unit1601.c +++ b/tests/unit/unit1601.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -40,6 +40,7 @@ UNITTEST_START unsigned char *testp = output; Curl_md5it(output, (const unsigned char *)"1"); +/* !checksrc! disable LONGLINE 2 */ verify_memory(testp, "\xc4\xca\x42\x38\xa0\xb9\x23\x82\x0d\xcc\x50\x9a\x6f\x75\x84\x9b", 16); diff --git a/tests/unit/unit1602.c b/tests/unit/unit1602.c index 63815551c..c67c0a555 100644 --- a/tests/unit/unit1602.c +++ b/tests/unit/unit1602.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -36,13 +36,13 @@ static void mydtor(void *p) free(ptr); } -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { return Curl_hash_init(&hash_static, 7, Curl_hash_str, Curl_str_key_compare, mydtor); } -static void unit_stop( void ) +static void unit_stop(void) { Curl_hash_destroy(&hash_static); } @@ -64,7 +64,6 @@ UNITTEST_START if(!nodep) free(value); abort_unless(nodep, "insertion into hash failed"); - Curl_hash_clean(&hash_static); /* Attempt to add another key/value pair */ diff --git a/tests/unit/unit1603.c b/tests/unit/unit1603.c index ffcd756e2..c20b20b0e 100644 --- a/tests/unit/unit1603.c +++ b/tests/unit/unit1603.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2015, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2015 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -37,13 +37,13 @@ static void mydtor(void *p) (void)p; /* unused */ } -static CURLcode unit_setup( void ) +static CURLcode unit_setup(void) { return Curl_hash_init(&hash_static, slots, Curl_hash_str, Curl_str_key_compare, mydtor); } -static void unit_stop( void ) +static void unit_stop(void) { Curl_hash_destroy(&hash_static); } diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c index c61f010dc..242be0005 100644 --- a/tests/unit/unit1604.c +++ b/tests/unit/unit1604.c @@ -45,7 +45,7 @@ static void unit_stop(void) static char *getflagstr(int flags) { char *buf = malloc(256); fail_unless(buf, "out of memory"); - sprintf(buf, "%s,%s,%s,%s", + snprintf(buf, 256, "%s,%s,%s,%s", ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""), ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""), ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""), @@ -56,7 +56,7 @@ static char *getflagstr(int flags) { static char *getcurlcodestr(int cc) { char *buf = malloc(256); fail_unless(buf, "out of memory"); - sprintf(buf, "%s (%d)", + snprintf(buf, 256, "%s (%d)", (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" : cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" : cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" : |