Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c2a16713
Commit
c2a16713
authored
Nov 23, 2016
by
tanshanshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace HTTP code with HTTP status code const
parent
7a09ba96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
links.go
cmd/linkcheck/links.go
+3
-3
No files found.
cmd/linkcheck/links.go
View file @
c2a16713
...
@@ -129,7 +129,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
...
@@ -129,7 +129,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
if
err
!=
nil
{
if
err
!=
nil
{
break
break
}
}
if
resp
.
StatusCode
==
429
{
if
resp
.
StatusCode
==
http
.
StatusTooManyRequests
{
retryAfter
:=
resp
.
Header
.
Get
(
"Retry-After"
)
retryAfter
:=
resp
.
Header
.
Get
(
"Retry-After"
)
if
seconds
,
err
:=
strconv
.
Atoi
(
retryAfter
);
err
!=
nil
{
if
seconds
,
err
:=
strconv
.
Atoi
(
retryAfter
);
err
!=
nil
{
backoff
=
seconds
+
10
backoff
=
seconds
+
10
...
@@ -138,7 +138,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
...
@@ -138,7 +138,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
time
.
Sleep
(
time
.
Duration
(
backoff
)
*
time
.
Second
)
time
.
Sleep
(
time
.
Duration
(
backoff
)
*
time
.
Second
)
backoff
*=
2
backoff
*=
2
retry
++
retry
++
}
else
if
resp
.
StatusCode
==
404
{
}
else
if
resp
.
StatusCode
==
http
.
StatusNotFound
{
// We only check for 404 error for now. 401, 403 errors are hard to handle.
// We only check for 404 error for now. 401, 403 errors are hard to handle.
// We need to try a GET to avoid false alert.
// We need to try a GET to avoid false alert.
...
@@ -146,7 +146,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
...
@@ -146,7 +146,7 @@ func newWalkFunc(invalidLink *bool, client *http.Client) filepath.WalkFunc {
if
err
!=
nil
{
if
err
!=
nil
{
break
break
}
}
if
resp
.
StatusCode
!=
404
{
if
resp
.
StatusCode
!=
http
.
StatusNotFound
{
continue
URL
continue
URL
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment