- $line =~ s{-section,,}{-section,,-proxy,$proxy,} unless $line =~ m/,\s*-proxy\s*,/;
+ my $noproxy = $no_proxy;
+ if ($line =~ m/,\s*-no_proxy\s*,(.*?)(,|$)/) {
+ $noproxy = $1;
+ } elsif ($server_host eq "127.0.0.1") {
+ # do connections to localhost (e.g., Mock server) without proxy
+ $line =~ s{-section,,}{-section,,-no_proxy,127.0.0.1,} ;
+ }
+ if ($line =~ m/,\s*-proxy\s*,/) {
+ next LOOP if $no_proxy && ($noproxy =~ $server_host);
+ } else {
+ $line =~ s{-section,,}{-section,,-proxy,$proxy,};
+ }