mirror of
https://github.com/curl/curl.git
synced 2025-09-18 18:12:49 +03:00
HTTP IPv6 support added to the test suite
This commit is contained in:
parent
1b8ac7c6b5
commit
9b3b7ad22e
20
CHANGES
20
CHANGES
|
@ -7,6 +7,26 @@
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
|
||||||
|
Daniel (11 December 2004)
|
||||||
|
- Made the test suite HTTP server (sws) capable of using IPv6, and then
|
||||||
|
extended the test environment to support that and also added three test
|
||||||
|
cases (240, 241, 242) that run tests using IPv6. One of them uses a URL that
|
||||||
|
didn't work before the 10 dec fix by Kai Sommerfeld.
|
||||||
|
|
||||||
|
- Made a failed file:// resume output an error message
|
||||||
|
|
||||||
|
- Corrected the CURLE_BAD_DOWNLOAD_RESUME error message in lib/strerror.c
|
||||||
|
|
||||||
|
- Dan Fandrich:
|
||||||
|
|
||||||
|
simplified and consolidated the SSL checks in configure and the usage of the
|
||||||
|
defines in lib/setup.h
|
||||||
|
|
||||||
|
provided a first libcurl.pc.in file for pkg-config (but the result is not
|
||||||
|
installed anywhere at this point)
|
||||||
|
|
||||||
|
extended the cross compile section in the docs/INSTALL file
|
||||||
|
|
||||||
Daniel (10 December 2004)
|
Daniel (10 December 2004)
|
||||||
- When providing user name in the URL and a IPv6-style IP-address (like in
|
- When providing user name in the URL and a IPv6-style IP-address (like in
|
||||||
"ftp://user@[::1]/tmp"), the URL parser didn't get the host extracted
|
"ftp://user@[::1]/tmp"), the URL parser didn't get the host extracted
|
||||||
|
|
|
@ -66,6 +66,6 @@ advice from friends like these:
|
||||||
Tim Sneddon, Ian Gulliver, Jean-Philippe Barrette-LaPierre, Jeff Phillips,
|
Tim Sneddon, Ian Gulliver, Jean-Philippe Barrette-LaPierre, Jeff Phillips,
|
||||||
Wojciech Zwiefka, David Phillips, Reinout van Schouwen, Maurice Barnum,
|
Wojciech Zwiefka, David Phillips, Reinout van Schouwen, Maurice Barnum,
|
||||||
Richard Atterer, Rene Bernhardt, Matt Veenstra, Bryan Henderson, Ton Voon,
|
Richard Atterer, Rene Bernhardt, Matt Veenstra, Bryan Henderson, Ton Voon,
|
||||||
Kai Sommerfeld
|
Kai Sommerfeld, David Byron
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
|
|
@ -77,10 +77,8 @@ reply is sent
|
||||||
<client>
|
<client>
|
||||||
|
|
||||||
<server>
|
<server>
|
||||||
protocols as in 'http' 'ftp' etc. Give only one per line. Used for test cases
|
What server(s) this test case requires/uses:
|
||||||
500+ (at this point) to specify which servers the test case requires. In the
|
'http' 'ftp', 'https', 'ftps', 'http-ipv6'. Give only one per line.
|
||||||
future all test cases should use this. Makes us independent of the test
|
|
||||||
case number.
|
|
||||||
</server>
|
</server>
|
||||||
|
|
||||||
<features>
|
<features>
|
||||||
|
|
|
@ -29,7 +29,8 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
|
||||||
test184 test185 test186 test187 test188 test189 test191 test192 \
|
test184 test185 test186 test187 test188 test189 test191 test192 \
|
||||||
test193 test194 test195 test196 test197 test198 test515 test516 \
|
test193 test194 test195 test196 test197 test198 test515 test516 \
|
||||||
test517 test518 test210 test211 test212 test220 test221 test222 \
|
test517 test518 test210 test211 test212 test220 test221 test222 \
|
||||||
test223 test224 test206 test207 test208 test209 test213
|
test223 test224 test206 test207 test208 test209 test213 test240 \
|
||||||
|
test241 test242
|
||||||
|
|
||||||
# The following tests have been removed from the dist since they no longer
|
# The following tests have been removed from the dist since they no longer
|
||||||
# work. We need to fix the test suite's FTPS server first, then bring them
|
# work. We need to fix the test suite's FTPS server first, then bring them
|
||||||
|
|
|
@ -24,7 +24,7 @@ Funny-head: yesyes
|
||||||
http
|
http
|
||||||
</server>
|
</server>
|
||||||
<name>
|
<name>
|
||||||
simple HTTP GET
|
HTTP GET
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
http://%HOSTIP:%HTTPPORT/1
|
http://%HOSTIP:%HTTPPORT/1
|
||||||
|
|
50
tests/data/test240
Normal file
50
tests/data/test240
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#
|
||||||
|
# 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>
|
||||||
|
<features>
|
||||||
|
ipv6
|
||||||
|
</features>
|
||||||
|
<server>
|
||||||
|
http-ipv6
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
HTTP-IPv6 GET
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
-g "http://%HOST6IP:%HTTP6PORT/240"
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /240 HTTP/1.1
|
||||||
|
Host: %HOST6IP:%HTTP6PORT
|
||||||
|
Pragma: no-cache
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
</verify>
|
44
tests/data/test241
Normal file
44
tests/data/test241
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
|
Server: test-server/fake
|
||||||
|
Content-Length: 6
|
||||||
|
|
||||||
|
hello
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<features>
|
||||||
|
ipv6
|
||||||
|
</features>
|
||||||
|
<server>
|
||||||
|
http-ipv6
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
HTTP-IPv6 GET (using ip6-localhost)
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
-g "http://ip6-localhost:%HTTP6PORT/241"
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /241 HTTP/1.1
|
||||||
|
Host: ip6-localhost:%HTTP6PORT
|
||||||
|
Pragma: no-cache
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
</verify>
|
45
tests/data/test242
Normal file
45
tests/data/test242
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data>
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
|
Content-Length: 6
|
||||||
|
Connection: close
|
||||||
|
|
||||||
|
hello
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<features>
|
||||||
|
ipv6
|
||||||
|
</features>
|
||||||
|
<server>
|
||||||
|
http-ipv6
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
HTTP-IPv6 GET with username+password in URL
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
-g "http://foobar:barfoo@%HOST6IP:%HTTP6PORT/242"
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<strip>
|
||||||
|
^User-Agent:
|
||||||
|
</strip>
|
||||||
|
<protocol>
|
||||||
|
GET /242 HTTP/1.1
|
||||||
|
Authorization: Basic Zm9vYmFyOmJhcmZvbw==
|
||||||
|
Host: %HOST6IP:%HTTP6PORT
|
||||||
|
Pragma: no-cache
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
</verify>
|
|
@ -6,6 +6,7 @@ my $verbose=0; # set to 1 for debugging
|
||||||
|
|
||||||
my $dir=".";
|
my $dir=".";
|
||||||
my $port = 8999; # just a default
|
my $port = 8999; # just a default
|
||||||
|
my $ipv6;
|
||||||
do {
|
do {
|
||||||
if($ARGV[0] eq "-v") {
|
if($ARGV[0] eq "-v") {
|
||||||
$verbose=1;
|
$verbose=1;
|
||||||
|
@ -17,6 +18,9 @@ do {
|
||||||
elsif($ARGV[0] =~ /^(\d+)$/) {
|
elsif($ARGV[0] =~ /^(\d+)$/) {
|
||||||
$port = $1;
|
$port = $1;
|
||||||
}
|
}
|
||||||
|
elsif($ARGV[0] =~ /^ipv6/i) {
|
||||||
|
$ipv6="--ipv6 ";
|
||||||
|
}
|
||||||
} while(shift @ARGV);
|
} while(shift @ARGV);
|
||||||
|
|
||||||
exec("server/sws $port $dir");
|
exec("server/sws $ipv6$port $dir");
|
||||||
|
|
|
@ -32,10 +32,12 @@ require "getpart.pm"; # array functions
|
||||||
|
|
||||||
my $srcdir = $ENV{'srcdir'} || '.';
|
my $srcdir = $ENV{'srcdir'} || '.';
|
||||||
my $HOSTIP="127.0.0.1";
|
my $HOSTIP="127.0.0.1";
|
||||||
|
my $HOST6IP="[::1]";
|
||||||
|
|
||||||
my $base = 8990; # base port number
|
my $base = 8990; # base port number
|
||||||
|
|
||||||
my $HTTPPORT; # HTTP server port
|
my $HTTPPORT; # HTTP server port
|
||||||
|
my $HTTP6PORT; # HTTP IPv6 server port
|
||||||
my $HTTPSPORT; # HTTPS server port
|
my $HTTPSPORT; # HTTPS server port
|
||||||
my $FTPPORT; # FTP server port
|
my $FTPPORT; # FTP server port
|
||||||
my $FTPSPORT; # FTPS server port
|
my $FTPSPORT; # FTPS server port
|
||||||
|
@ -61,6 +63,7 @@ my $TESTCASES="all";
|
||||||
#
|
#
|
||||||
|
|
||||||
my $HTTPPIDFILE=".http.pid";
|
my $HTTPPIDFILE=".http.pid";
|
||||||
|
my $HTTP6PIDFILE=".http6.pid";
|
||||||
my $HTTPSPIDFILE=".https.pid";
|
my $HTTPSPIDFILE=".https.pid";
|
||||||
my $FTPPIDFILE=".ftp.pid";
|
my $FTPPIDFILE=".ftp.pid";
|
||||||
my $FTPSPIDFILE=".ftps.pid";
|
my $FTPSPIDFILE=".ftps.pid";
|
||||||
|
@ -95,6 +98,7 @@ my $gdb = checkcmd("gdb");
|
||||||
my $ssl_version; # set if libcurl is built with SSL support
|
my $ssl_version; # set if libcurl is built with SSL support
|
||||||
my $large_file; # set if libcurl is built with large file support
|
my $large_file; # set if libcurl is built with large file support
|
||||||
my $has_idn; # set if libcurl is built with IDN support
|
my $has_idn; # set if libcurl is built with IDN support
|
||||||
|
my $http_ipv6; # set if HTTP server has IPv6 support
|
||||||
my $has_ipv6; # set if libcurl is built with IPv6 support
|
my $has_ipv6; # set if libcurl is built with IPv6 support
|
||||||
my $has_libz; # set if libcurl is built with libz support
|
my $has_libz; # set if libcurl is built with libz support
|
||||||
my $has_getrlimit; # set if system has getrlimit()
|
my $has_getrlimit; # set if system has getrlimit()
|
||||||
|
@ -325,14 +329,28 @@ sub checkserver {
|
||||||
# test server on the test-port!
|
# test server on the test-port!
|
||||||
#
|
#
|
||||||
sub runhttpserver {
|
sub runhttpserver {
|
||||||
my $verbose = $_[0];
|
my ($verbose, $ipv6) = @_;
|
||||||
my $RUNNING;
|
my $RUNNING;
|
||||||
my $pid;
|
my $pid;
|
||||||
|
|
||||||
$pid = checkserver ($HTTPPIDFILE);
|
my $pidfile = $HTTPPIDFILE;
|
||||||
|
my $port = $HTTPPORT;
|
||||||
|
my $ip = $HOSTIP;
|
||||||
|
my $nameext;
|
||||||
|
|
||||||
|
if($ipv6) {
|
||||||
|
# if IPv6, use a different setup
|
||||||
|
$pidfile = $HTTP6PIDFILE;
|
||||||
|
$port = $HTTP6PORT;
|
||||||
|
$ip = $HOST6IP;
|
||||||
|
$nameext="-ipv6";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$pid = checkserver($pidfile);
|
||||||
|
|
||||||
# verify if our/any server is running on this port
|
# verify if our/any server is running on this port
|
||||||
my $cmd = "$CURL -o log/verifiedserver http://$HOSTIP:$HTTPPORT/verifiedserver 2>/dev/null";
|
my $cmd = "$CURL -o log/verifiedserver -g \"http://$ip:$port/verifiedserver\" 2>/dev/null";
|
||||||
print "CMD; $cmd\n" if ($verbose);
|
print "CMD; $cmd\n" if ($verbose);
|
||||||
my $res = system($cmd);
|
my $res = system($cmd);
|
||||||
|
|
||||||
|
@ -350,15 +368,15 @@ sub runhttpserver {
|
||||||
$pid = 0+$1;
|
$pid = 0+$1;
|
||||||
}
|
}
|
||||||
elsif($data || ($res != 7)) {
|
elsif($data || ($res != 7)) {
|
||||||
print "RUN: Unknown HTTP server is running on port $HTTPPORT\n";
|
print "RUN: Unknown server is running on port $port\n";
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pid > 0) {
|
if($pid > 0) {
|
||||||
my $res = kill (9, $pid); # die!
|
my $res = kill (9, $pid); # die!
|
||||||
if(!$res) {
|
if(!$res) {
|
||||||
print "RUN: Failed to kill test HTTP server, do it manually and",
|
print "RUN: Failed to kill test HTTP$nameext server, do it ",
|
||||||
" restart the tests.\n";
|
"manually and restart the tests.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
@ -369,7 +387,7 @@ sub runhttpserver {
|
||||||
if($dir) {
|
if($dir) {
|
||||||
$flag .= "-d \"$dir\" ";
|
$flag .= "-d \"$dir\" ";
|
||||||
}
|
}
|
||||||
$cmd="$perl $srcdir/httpserver.pl $flag $HTTPPORT &";
|
$cmd="$perl $srcdir/httpserver.pl $flag $port $ipv6 &";
|
||||||
system($cmd);
|
system($cmd);
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
print "CMD: $cmd\n";
|
print "CMD: $cmd\n";
|
||||||
|
@ -378,7 +396,7 @@ sub runhttpserver {
|
||||||
my $verified;
|
my $verified;
|
||||||
for(1 .. 10) {
|
for(1 .. 10) {
|
||||||
# verify that our server is up and running:
|
# verify that our server is up and running:
|
||||||
my $data=`$CURL --silent $HOSTIP:$HTTPPORT/verifiedserver 2>/dev/null`;
|
my $data=`$CURL --silent -g \"$ip:$port/verifiedserver\" 2>/dev/null`;
|
||||||
|
|
||||||
if ( $data =~ /WE ROOLZ: (\d+)/ ) {
|
if ( $data =~ /WE ROOLZ: (\d+)/ ) {
|
||||||
$pid = 0+$1;
|
$pid = 0+$1;
|
||||||
|
@ -387,19 +405,19 @@ sub runhttpserver {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
print STDERR "RUN: Retrying HTTP server existence in 3 sec\n";
|
print STDERR "RUN: Retrying HTTP$nameext server existence in 3 sec\n";
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$verified) {
|
if(!$verified) {
|
||||||
print STDERR "RUN: failed to start our HTTP server\n";
|
print STDERR "RUN: failed to start our HTTP$nameext server\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($verbose) {
|
if($verbose) {
|
||||||
print "RUN: HTTP server is now verified to be our server\n";
|
print "RUN: HTTP$nameext server is now verified to be our server\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $pid;
|
return $pid;
|
||||||
|
@ -783,6 +801,15 @@ sub checkcurl {
|
||||||
close(CONF);
|
close(CONF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($has_ipv6) {
|
||||||
|
# client has ipv6 support, check that the HTTP server has it!
|
||||||
|
my @sws = `server/sws --version`;
|
||||||
|
if($sws[0] =~ /IPv6/) {
|
||||||
|
# HTTP server has ipv6 support!
|
||||||
|
$http_ipv6 = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!$curl_debug && $torture) {
|
if(!$curl_debug && $torture) {
|
||||||
die "can't run torture tests since curl was not build with debug";
|
die "can't run torture tests since curl was not build with debug";
|
||||||
}
|
}
|
||||||
|
@ -797,15 +824,20 @@ sub checkcurl {
|
||||||
"* Host: $hostname",
|
"* Host: $hostname",
|
||||||
"* System: $hosttype";
|
"* System: $hosttype";
|
||||||
|
|
||||||
printf("* Server SSL: %s\n", $stunnel?"ON":"OFF");
|
printf("* Server SSL: %s\n", $stunnel?"ON":"OFF");
|
||||||
printf("* libcurl SSL: %s\n", $ssl_version?"ON":"OFF");
|
printf("* libcurl SSL: %s\n", $ssl_version?"ON":"OFF");
|
||||||
printf("* libcurl debug: %s\n", $curl_debug?"ON":"OFF");
|
printf("* libcurl debug: %s\n", $curl_debug?"ON":"OFF");
|
||||||
printf("* valgrind: %s\n", $valgrind?"ON":"OFF");
|
printf("* valgrind: %s\n", $valgrind?"ON":"OFF");
|
||||||
printf("* HTTP on port: %d\n", $HTTPPORT);
|
printf("* HTTP IPv6 %s\n", $http_ipv6?"ON":"OFF");
|
||||||
printf("* FTP on port: %d\n", $FTPPORT);
|
|
||||||
|
printf("* HTTP port: %d\n", $HTTPPORT);
|
||||||
|
printf("* FTP port: %d\n", $FTPPORT);
|
||||||
if($stunnel) {
|
if($stunnel) {
|
||||||
printf("* FTPS on port: %d\n", $FTPSPORT);
|
printf("* FTPS port: %d\n", $FTPSPORT);
|
||||||
printf("* HTTPS on port: %d\n", $HTTPSPORT);
|
printf("* HTTPS port: %d\n", $HTTPSPORT);
|
||||||
|
}
|
||||||
|
if($http_ipv6) {
|
||||||
|
printf("* HTTP IPv6 port: %d\n", $HTTP6PORT);
|
||||||
}
|
}
|
||||||
print "***************************************** \n";
|
print "***************************************** \n";
|
||||||
}
|
}
|
||||||
|
@ -818,6 +850,8 @@ sub subVariables {
|
||||||
my ($thing) = @_;
|
my ($thing) = @_;
|
||||||
$$thing =~ s/%HOSTIP/$HOSTIP/g;
|
$$thing =~ s/%HOSTIP/$HOSTIP/g;
|
||||||
$$thing =~ s/%HTTPPORT/$HTTPPORT/g;
|
$$thing =~ s/%HTTPPORT/$HTTPPORT/g;
|
||||||
|
$$thing =~ s/%HOST6IP/$HOST6IP/g;
|
||||||
|
$$thing =~ s/%HTTP6PORT/$HTTP6PORT/g;
|
||||||
$$thing =~ s/%HTTPSPORT/$HTTPSPORT/g;
|
$$thing =~ s/%HTTPSPORT/$HTTPSPORT/g;
|
||||||
$$thing =~ s/%FTPPORT/$FTPPORT/g;
|
$$thing =~ s/%FTPPORT/$FTPPORT/g;
|
||||||
$$thing =~ s/%FTPSPORT/$FTPSPORT/g;
|
$$thing =~ s/%FTPSPORT/$FTPSPORT/g;
|
||||||
|
@ -1116,7 +1150,7 @@ sub singletest {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($valgrind) {
|
if($valgrind) {
|
||||||
$CMDLINE = "valgrind ".$valgrind_tool."--leak-check=yes --logfile=log/valgrind$testnum -q $CMDLINE";
|
$CMDLINE = "valgrind ".$valgrind_tool."--leak-check=yes --logfile=log/valgrind$testnum $CMDLINE";
|
||||||
}
|
}
|
||||||
|
|
||||||
$CMDLINE .= "$cmdargs >>$STDOUT 2>>$STDERR";
|
$CMDLINE .= "$cmdargs >>$STDOUT 2>>$STDERR";
|
||||||
|
@ -1439,7 +1473,7 @@ sub startservers {
|
||||||
my $pid;
|
my $pid;
|
||||||
for(@what) {
|
for(@what) {
|
||||||
my $what = lc($_);
|
my $what = lc($_);
|
||||||
$what =~ s/[^a-z]//g;
|
$what =~ s/[^a-z0-9-]//g;
|
||||||
if($what eq "ftp") {
|
if($what eq "ftp") {
|
||||||
if(!$run{'ftp'}) {
|
if(!$run{'ftp'}) {
|
||||||
$pid = runftpserver($verbose);
|
$pid = runftpserver($verbose);
|
||||||
|
@ -1460,6 +1494,16 @@ sub startservers {
|
||||||
$run{'http'}=$pid;
|
$run{'http'}=$pid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elsif($what eq "http-ipv6") {
|
||||||
|
if(!$run{'http-ipv6'}) {
|
||||||
|
$pid = runhttpserver($verbose, "IPv6");
|
||||||
|
if($pid <= 0) {
|
||||||
|
return 2; # error starting
|
||||||
|
}
|
||||||
|
printf ("* pid http-ipv6 => %-5d\n", $pid) if($verbose);
|
||||||
|
$run{'http-ipv6'}=$pid;
|
||||||
|
}
|
||||||
|
}
|
||||||
elsif($what eq "ftps") {
|
elsif($what eq "ftps") {
|
||||||
if(!$stunnel || !$ssl_version) {
|
if(!$stunnel || !$ssl_version) {
|
||||||
# we can't run ftps tests without stunnel
|
# we can't run ftps tests without stunnel
|
||||||
|
@ -1671,6 +1715,8 @@ $HTTPPORT = $base + 0; # HTTP server port
|
||||||
$HTTPSPORT = $base + 1; # HTTPS server port
|
$HTTPSPORT = $base + 1; # HTTPS server port
|
||||||
$FTPPORT = $base + 2; # FTP server port
|
$FTPPORT = $base + 2; # FTP server port
|
||||||
$FTPSPORT = $base + 3; # FTPS server port
|
$FTPSPORT = $base + 3; # FTPS server port
|
||||||
|
$HTTP6PORT = $base + 4; # HTTP IPv6 server port (different IP protocol
|
||||||
|
# but we follow the same port scheme anyway)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Output curl version and host info being tested
|
# Output curl version and host info being tested
|
||||||
|
|
|
@ -58,6 +58,10 @@
|
||||||
#include "curlx.h" /* from the private lib dir */
|
#include "curlx.h" /* from the private lib dir */
|
||||||
#include "getpart.h"
|
#include "getpart.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
#define SWS_IPV6
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -709,19 +713,46 @@ static void win32_cleanup(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char use_ipv6=FALSE;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
struct sockaddr_in me;
|
struct sockaddr_in me;
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
struct sockaddr_in6 me6;
|
||||||
|
#endif /* ENABLE_IPV6 */
|
||||||
int sock, msgsock, flag;
|
int sock, msgsock, flag;
|
||||||
unsigned short port = DEFAULT_PORT;
|
unsigned short port = DEFAULT_PORT;
|
||||||
FILE *pidfile;
|
FILE *pidfile;
|
||||||
struct httprequest req;
|
struct httprequest req;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if(argc>1) {
|
if(argc>1) {
|
||||||
port = (unsigned short)atoi(argv[1]);
|
int arg=1;
|
||||||
|
if(!strcmp("--version", argv[arg])) {
|
||||||
|
printf("sws IPv4%s\n",
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
"/IPv6"
|
||||||
|
#else
|
||||||
|
""
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(!strcmp("--ipv6", argv[arg])) {
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
use_ipv6=TRUE;
|
||||||
|
#endif
|
||||||
|
arg++;
|
||||||
|
}
|
||||||
|
if(argc>arg) {
|
||||||
|
|
||||||
|
if(atoi(argv[arg]))
|
||||||
|
port = (unsigned short)atoi(argv[arg++]);
|
||||||
|
|
||||||
|
if(argc>arg)
|
||||||
|
path = argv[arg];
|
||||||
|
|
||||||
if(argc>2) {
|
|
||||||
path = argv[2];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,10 +771,18 @@ int main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
#ifdef ENABLE_IPV6
|
||||||
|
if(!use_ipv6)
|
||||||
|
#endif
|
||||||
|
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
else
|
||||||
|
sock = socket(AF_INET6, SOCK_STREAM, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (sock < 0) {
|
if (sock < 0) {
|
||||||
perror("opening stream socket");
|
perror("opening stream socket");
|
||||||
logmsg("Error opening socket -- aborting\n");
|
logmsg("Error opening socket");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,12 +793,26 @@ int main(int argc, char *argv[])
|
||||||
perror("setsockopt(SO_REUSEADDR)");
|
perror("setsockopt(SO_REUSEADDR)");
|
||||||
}
|
}
|
||||||
|
|
||||||
me.sin_family = AF_INET;
|
#ifdef ENABLE_IPV6
|
||||||
me.sin_addr.s_addr = INADDR_ANY;
|
if(!use_ipv6) {
|
||||||
me.sin_port = htons(port);
|
#endif
|
||||||
if (bind(sock, (struct sockaddr *) &me, sizeof me) < 0) {
|
me.sin_family = AF_INET;
|
||||||
|
me.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
me.sin_port = htons(port);
|
||||||
|
rc = bind(sock, (struct sockaddr *) &me, sizeof(me));
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
memset(&me6, 0, sizeof(struct sockaddr_in6));
|
||||||
|
me6.sin6_family = AF_INET6;
|
||||||
|
me6.sin6_addr = in6addr_any;
|
||||||
|
me6.sin6_port = htons(port);
|
||||||
|
rc = bind(sock, (struct sockaddr *) &me6, sizeof(me6));
|
||||||
|
}
|
||||||
|
#endif /* ENABLE_IPV6 */
|
||||||
|
if(rc < 0) {
|
||||||
perror("binding stream socket");
|
perror("binding stream socket");
|
||||||
logmsg("Error binding socket -- aborting\n");
|
logmsg("Error binding socket");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,6 +824,14 @@ int main(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Couldn't write pid file\n");
|
fprintf(stderr, "Couldn't write pid file\n");
|
||||||
|
|
||||||
|
logmsg("Running IPv%d version",
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
|
(use_ipv6?6:4)
|
||||||
|
#else
|
||||||
|
4
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
|
||||||
/* start accepting connections */
|
/* start accepting connections */
|
||||||
listen(sock, 5);
|
listen(sock, 5);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user