sullo / nikto

Nikto web server scanner
Other
8.36k stars 1.21k forks source link

Convert six variable assignments to the usage of combined operators #779

Closed elfring closed 1 year ago

elfring commented 1 year ago

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of combined operators accordingly.

diff --git a/program/plugins/LW2.pm b/program/plugins/LW2.pm
index a909468..28ab6ae 100644
--- a/program/plugins/LW2.pm
+++ b/program/plugins/LW2.pm
@@ -532,8 +532,8 @@ sub cookie_write {
     return if ( !( defined $jarref && ref($jarref) ) );
     return if ( !( defined $hin    && ref($hin) ) );

-    $override = $override || 0;
-    $$hin{'whisker'}->{'ssl'} = $$hin{'whisker'}->{'ssl'} || 0;
+    $override ||= 0;
+    $$hin{'whisker'}->{'ssl'} ||= 0;

     foreach $name ( keys %$jarref ) {
         next if ( $name eq '' );
@@ -673,8 +673,8 @@ sub cookie_set {
         delete $$jarref{$name};
         return;
     }
-    $path   = $path   || '/';
-    $secure = $secure || 0;
+    $path ||= '/';
+    $secure ||= 0;

     @construct = ( $value, $domain, $path, undef, $secure );
     $$jarref{$name} = \@construct;
@@ -986,7 +986,7 @@ Returns the number of URLs actually crawled (not including those skipped).
                     $TRACK->{ $v[0] } = '?'
                       if ( $CONFIG->{params_double_record} > 0
                         && !defined $TRACK->{ $v[0] } );
-                    $v[0] = $v[0] . '?' . $v[4];
+                    $v[0] .= '?' . $v[4];
                 }

                 next
@@ -3190,7 +3190,7 @@ sub http_read_body {
                 $stream->{'close'}->();
                 return 0;
             }
-            $$hout{whisker}->{'data'} = $$hout{whisker}->{'data'} . $temp;
+            $$hout{whisker}->{'data'} .= $temp;
             $total += $len;
             if ( $max_size && $total >= $max_size ) {
                 $stream->{'close'}->();
sullo commented 1 year ago

Changed, thanks.

elfring commented 1 year ago

Thanks for your integration of a small source code improvement.