mirror of
https://github.com/curl/curl.git
synced 2026-07-24 02:27:20 +03:00
mdlinkcheck: pass curl arguments to open() as list
To prevent misinterpreting quotes or other special characters. Requires Perl 5.22+ (2015-Jun-01) on Windows. Ref: https://perldoc.perl.org/functions/open Closes #19437
This commit is contained in:
parent
b39c158e4a
commit
77be4a7ab2
1 changed files with 8 additions and 4 deletions
|
|
@ -138,13 +138,17 @@ sub checkurl {
|
|||
}
|
||||
|
||||
print "check $url\n";
|
||||
my $curlcmd="curl -ILfsm10 --retry 2 --retry-delay 5 -A \"Mozilla/curl.se link-probe\"";
|
||||
$url =~ s/\+/%2B/g;
|
||||
if($url =~ /[\"\'\n]/) {
|
||||
print STDERR "Bad URL in markdown: %s\n", $url{$url};
|
||||
my @content;
|
||||
if(open(my $fh, '-|', 'curl', '-ILfsm10', '--retry', '2', '--retry-delay', '5',
|
||||
'-A', 'Mozilla/curl.se link-probe', $url)) {
|
||||
@content = <$fh>;
|
||||
close $fh;
|
||||
}
|
||||
else {
|
||||
print STDERR "FAIL\n";
|
||||
return 1; # fail
|
||||
}
|
||||
my @content = `$curlcmd \"$url\"`;
|
||||
if(!$content[0]) {
|
||||
print STDERR "FAIL\n";
|
||||
return 1; # fail
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue