Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
0d12c567
Commit
0d12c567
authored
24 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Added -i to allow ingore-patterns to get added
parent
880208c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
perl/crawlink.pl
+32
-10
32 additions, 10 deletions
perl/crawlink.pl
with
32 additions
and
10 deletions
perl/crawlink.pl
+
32
−
10
View file @
0d12c567
...
...
@@ -9,10 +9,14 @@
# Written to use 'curl' for URL checking.
#
# Author: Daniel Stenberg <daniel@haxx.se>
# Version: 0.
2 Dec 19
, 200
0
# Version: 0.
3 Jan 3
, 200
1
#
# HISTORY
#
# 0.3 - The -i now adds regexes that if a full URL link matches one of those,
# it is not followed. This can then be used to prevent this script from
# following '.*\.cgi', specific pages or whatever.
#
# 0.2 - Made it only HEAD non html files (i.e skip the GET). Makes it a lot
# faster to skip large non HTML files such as pdfs or big RFCs! ;-)
# Added a -c option that allows me to pass options to curl.
...
...
@@ -32,6 +36,8 @@ my $help;
my
$external
;
my
$curlopts
;
my
@ignorelist
;
argv:
if
(
$ARGV
[
0
]
eq
"
-v
"
)
{
$verbose
++
;
...
...
@@ -44,6 +50,12 @@ elsif($ARGV[0] eq "-c" ) {
shift
@ARGV
;
goto
argv
;
}
elsif
(
$ARGV
[
0
]
eq
"
-i
"
)
{
push
@ignorelist
,
$ARGV
[
1
];
shift
@ARGV
;
shift
@ARGV
;
goto
argv
;
}
elsif
(
$ARGV
[
0
]
eq
"
-l
"
)
{
$linenumber
=
1
;
shift
@ARGV
;
...
...
@@ -72,10 +84,12 @@ $rooturls{$ARGV[0]}=1;
if
((
$geturl
eq
"")
||
$help
)
{
print
"
Usage: $0 [-hilvx] <full URL>
\n
",
"
Use a traling slash for directory URLs!
\n
",
"
-h This help text
\n
",
"
-l Line number report for BAD links
\n
",
"
-v Verbose mode
\n
",
"
-x Check non-local (external?) links only
\n
";
"
-c [data] Pass [data] as argument to every curl invoke
\n
",
"
-h This help text
\n
",
"
-i [regex] Ignore root links that match this pattern
\n
",
"
-l Line number report for BAD links
\n
",
"
-v Verbose mode
\n
",
"
-x Check non-local (external?) links only
\n
";
exit
;
}
...
...
@@ -303,9 +317,6 @@ while(1) {
if
(
$geturl
==
-
1
)
{
last
;
}
if
(
$verbose
)
{
print
"
ROOT:
$geturl
\n
";
}
#
# Splits the URL in its different parts
...
...
@@ -332,6 +343,8 @@ while(1) {
next
;
}
print
"
====
$geturl
====
\n
";
if
(
$verbose
==
2
)
{
printf
("
Error code
$error
, Content-Type:
$ctype
, got %d bytes
\n
",
length
(
$in
));
...
...
@@ -405,8 +418,17 @@ while(1) {
}
}
else
{
# the link works, add it!
$rooturls
{
$link
}
++
;
# check this if not checked already
# the link works, add it if it isn't in the ingore list
my
$ignore
=
0
;
for
(
@ignorelist
)
{
if
(
$link
=~
/$_/
)
{
$ignore
=
1
;
}
}
if
(
!
$ignore
)
{
# not ignored, add
$rooturls
{
$link
}
++
;
# check this if not checked already
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment