Author: mzugec Date: Thu Jul 3 14:59:00 2008 New Revision: 48827 URL: http://svn.opensuse.org/viewcvs/yast?rev=48827&view=rev Log: initial support for IPv6 Modified: trunk/http-server/VERSION trunk/http-server/package/yast2-http-server.changes trunk/http-server/src/HttpServerWidgets.ycp trunk/http-server/src/YaPI/HTTPD.pm trunk/http-server/src/YaST/HTTPDData.pm Modified: trunk/http-server/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/VERSION?rev=48827&r1=48826&r2=48827&view=diff ============================================================================== --- trunk/http-server/VERSION (original) +++ trunk/http-server/VERSION Thu Jul 3 14:59:00 2008 @@ -1 +1 @@ -2.17.1 +2.17.2 Modified: trunk/http-server/package/yast2-http-server.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/package/yast2-http-server.changes?rev=48827&r1=48826&r2=48827&view=diff ============================================================================== --- trunk/http-server/package/yast2-http-server.changes (original) +++ trunk/http-server/package/yast2-http-server.changes Thu Jul 3 14:59:00 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Jul 3 14:58:20 CEST 2008 - mzugec@suse.de + +- initial support for IPv6 +- 2.17.2 + +------------------------------------------------------------------- Sun Jun 29 18:55:29 CEST 2008 - mzugec@suse.de - fixed help text about IP-based vhost & SSL (bnc#383720) Modified: trunk/http-server/src/HttpServerWidgets.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/HttpServerWidgets.ycp?rev=48827&r1=48826&r2=48827&view=diff ============================================================================== --- trunk/http-server/src/HttpServerWidgets.ycp (original) +++ trunk/http-server/src/HttpServerWidgets.ycp Thu Jul 3 14:59:00 2008 @@ -140,11 +140,14 @@ string value = (string)UI::QueryWidget (`id (id), `Value); // check, if there is also a port, if yes, skip it - integer pos = search (value, ":"); - if (pos != nil) value = substring (value, 0, pos); +// integer pos = search (value, ":"); +// if (pos != nil) value = substring (value, 0, pos); // validate wildcard if (value == "*") return true; + // remove brackets before validation (because of IPv6 [::]) + if (substring(value, 0, 1)=="[" && substring(value, size(value)-1, 1)=="]") + value = substring(value, 1, size(value)-2); if (!IP::Check (value)) { @@ -1048,7 +1051,10 @@ define string changeVHostPopup(string value){ string vhost=""; - list items = maplist( string ip, string dev, HttpServer::ip2device, ``(ip) ); + list items = maplist( string ip, string dev, HttpServer::ip2device, { + if (IP::Check6(ip)) return sformat("[%1]", ip); + else return ip; + } ); UI::OpenDialog( `RadioButtonGroup(`id(`rb), `VBox( @@ -1883,8 +1889,11 @@ // translators: Listen type for all addresses; string aa = _("All Addresses"); - list ips = union( [ aa ], maplist( string ip, string dev, HttpServer::ip2device, ``( ip ) ) ); - + list ips = union( [ aa ], maplist( string ip, string dev, HttpServer::ip2device, + { + if (IP::Check6(ip)) return sformat("[%1]", ip); + else return ip; + } ) ); UI::OpenDialog( `VBox( `TextEntry( `id(`port), Label::Port(), port ), // translators: combo box label for list of configured IPs @@ -2621,8 +2630,10 @@ } else { +// if (IP::Check6(res["ADDRESS"]:"")) res["ADDRESS"]=sformat("[%1]", res["ADDRESS"]:""); YaST::HTTPDData::CreateListen( tointeger(res["PORT"]:"80"), tointeger(res["PORT"]:"80"), res["ADDRESS"]:"" ); +y2internal("get %1", YaST::HTTPDData::GetCurrentListen()); HttpServer::modified = true; } } @@ -2639,7 +2650,6 @@ listen cannot be empty.") ); return nil; } - // remove the entry YaST::HTTPDData::DeleteListen( tointeger(port), tointeger(port), network ); HttpServer::modified = true; Modified: trunk/http-server/src/YaPI/HTTPD.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/YaPI/HTTPD.pm?rev=48827&r1=48826&r2=48827&view=diff ============================================================================== --- trunk/http-server/src/YaPI/HTTPD.pm (original) +++ trunk/http-server/src/YaPI/HTTPD.pm Thu Jul 3 14:59:00 2008 @@ -1307,6 +1307,7 @@ my @listenEntries = @{$self->GetCurrentListen()}; my %newEntry; $newEntry{ADDRESS} = $ip if ($ip); + $newEntry{ADDRESS} = "[$ip]" if ($ip=~m/\:/); $newEntry{PORT} = ($fromPort eq $toPort)?($fromPort):($fromPort.'-'.$toPort); SCR->Write( ".http_server.listen", [ @listenEntries, \%newEntry ] ); @@ -1408,12 +1409,19 @@ if( not ref($data[0]) ) { return $self->SetError( %{SCR->Error(".http_server.listen")} ); } - foreach my $listen ( @{$data[0]} ) { - if( $listen =~ /^([^:]+):([^:]+)/ ) { - push( @ret, { ADDRESS => $1, PORT => $2 } ); - } elsif( $listen =~ /^\d+$/ ) { - push( @ret, { PORT => $listen } ); - } + foreach my $new ( @{$data[0]} ) { + my ($ip, $fp, $tp, $port) = ('', '', '', ''); + if ($new =~ m/\[([\w\W]*)\]([\w\W]*)/){ + $ip="[$1]"; + if ($2 =~ m/([\d\:]*)/){ + ($fp, $tp) = split(/:/, $1); + } else{ + ( $ip, $fp, $tp ) = split(/:/, $new); + } + $fp=$tp if ($fp eq ''); + $port = ($fp eq $tp)?($fp):($fp.'-'.$tp); + } + push(@ret, {ADDRESS => $ip, PORT=>$port}); } return \@ret; } Modified: trunk/http-server/src/YaST/HTTPDData.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/http-server/src/YaST/HTTPDData.pm?rev=48827&r1=48826&r2=48827&view=diff ============================================================================== --- trunk/http-server/src/YaST/HTTPDData.pm (original) +++ trunk/http-server/src/YaST/HTTPDData.pm Thu Jul 3 14:59:00 2008 @@ -546,7 +546,7 @@ return 1; } -# boolean CreateListen( int, int, list<string> ) +# boolean DeleteListen( int, int, list<string> ) BEGIN { $TYPEINFO{DeleteListen} = ["function", "boolean", "integer", "integer", "string" ] ; } sub DeleteListen { my $self = shift; @@ -566,8 +566,17 @@ my $self = shift; my @new; foreach my $new ( keys(%newListen) ) { - my ( $ip, $fp, $tp ) = split(/:/, $new); - my $port = ($fp eq $tp)?($fp):($fp.'-'.$tp); + my ($ip, $fp, $tp, $port) = ('', '', '', ''); + if ($new =~ m/\[([\w\W]*)\]/){ + $ip=$1; + if ($new =~ m/\[$ip\]:([\d\:]*)/){ + ($fp, $tp) = split(/:/, $1); + } else{ + ( $ip, $fp, $tp ) = split(/:/, $new); + } + $tp=$fp if ($tp eq ''); + $port = ($fp eq $tp)?($fp):($fp.'-'.$tp); + } push( @new, { ADDRESS => $ip, PORT => $port } ); } foreach my $old ( @oldListen ) { @@ -589,13 +598,33 @@ my $self = shift; my $doFirewall = shift; my $ret = 1; - + foreach my $toDel ( keys(%delListen) ) { - my ($ip,$fp,$tp) = split(/:/, $toDel); + my ($ip, $fp, $tp, $port) = ('', '', '', ''); + if ($toDel =~ m/\[([\w\W]*)\]/){ + $ip=$1; + if ($toDel =~ m/\[$ip\]:([\d\:]*)/){ + ($fp, $tp) = split(/:/, $1); + } else{ + ( $ip, $fp, $tp ) = split(/:/, $toDel); + } + $tp=$fp if ($tp eq ''); + } + $ip="[$ip]" if ($ip=~m/:/); YaPI::HTTPD->DeleteListen( $fp, $tp, $ip, $doFirewall ); } - foreach my $toCreate ( keys(%newListen) ) { - my ($ip,$fp,$tp) = split(/:/, $toCreate); + foreach my $new ( keys(%newListen) ) { + my ($ip, $fp, $tp, $port) = ('', '', '', ''); + if ($new =~ m/\[([\w\W]*)\]/){ + $ip=$1; + if ($new =~ m/\[$ip\]:([\d\:]*)/){ + ($fp, $tp) = split(/:/, $1); + } else{ + ( $ip, $fp, $tp ) = split(/:/, $new); + } + $tp=$fp if ($tp eq ''); + $port = ($fp eq $tp)?($fp):($fp.'-'.$tp); + } unless( YaPI::HTTPD->CreateListen( $fp, $tp, $ip, $doFirewall ) ) { $ret = undef; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org