-
-
Notifications
You must be signed in to change notification settings - Fork 183
Redirect reporting #1725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect reporting #1725
Changes from 24 commits
ec0d5b9
049075a
3fd68ca
92ed479
b68ff7b
4150e15
f0c5e28
14119f6
7513537
24b04b7
d96481b
482f9cc
5962f67
bb10776
a228c05
5fd38a4
99c5983
79a80aa
762da6b
156ee4e
b74cfb0
613ec22
69cd4f6
34e5f34
cbd939f
8e5dc74
061e6e1
21f434b
2170435
483cad8
b96b874
c62b099
d4210f8
b630508
bfd231c
59bc64e
9a20ce6
c4e059e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -850,3 +850,9 @@ at your option. | |
|
|
||
| <br><hr> | ||
| [πΌ Back to top](#back-to-top) | ||
|
|
||
|
|
||
|
|
||
| # TODO: redirections | ||
|
|
||
| - Add redirect_map to JSON | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| Test file: contains a single GitHub URL. | ||
|
|
||
| Lychee: https://github.com/hello-rust/lychee | ||
| Lychee: https://github.com/lycheeverse/lychee |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,13 +37,15 @@ pub(crate) struct ResponseStats { | |
| pub(crate) errors: usize, | ||
| /// Number of responses that were cached from a previous run | ||
| pub(crate) cached: usize, | ||
| /// Map to store successful responses (if `detailed_stats` is enabled) | ||
| /// Store successful responses (if `detailed_stats` is enabled) | ||
| pub(crate) success_map: HashMap<InputSource, HashSet<ResponseBody>>, | ||
| /// Map to store failed responses (if `detailed_stats` is enabled) | ||
| /// Store failed responses (if `detailed_stats` is enabled) | ||
| pub(crate) error_map: HashMap<InputSource, HashSet<ResponseBody>>, | ||
| /// Replacement suggestions for failed responses (if `--suggest` is enabled) | ||
| pub(crate) suggestion_map: HashMap<InputSource, HashSet<Suggestion>>, | ||
| /// Map to store excluded responses (if `detailed_stats` is enabled) | ||
| /// Store redirected responses with their redirection chain (if `detailed_stats` is enabled) | ||
| pub(crate) redirect_map: HashMap<InputSource, HashSet<ResponseBody>>, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really store the redirection list here as the comment suggests?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, see my previous comment section |
||
| /// Store excluded responses (if `detailed_stats` is enabled) | ||
| pub(crate) excluded_map: HashMap<InputSource, HashSet<ResponseBody>>, | ||
| /// Used to store the duration of the run in seconds. | ||
| pub(crate) duration_secs: u64, | ||
|
|
@@ -72,7 +74,7 @@ impl ResponseStats { | |
| Status::Error(_) => self.errors += 1, | ||
| Status::UnknownStatusCode(_) => self.unknown += 1, | ||
| Status::Timeout(_) => self.timeouts += 1, | ||
| Status::Redirected(_) => self.redirects += 1, | ||
| Status::Redirected(_, _) => self.redirects += 1, | ||
| Status::Excluded => self.excludes += 1, | ||
| Status::Unsupported(_) => self.unsupported += 1, | ||
| Status::Cached(cache_status) => { | ||
|
|
@@ -95,6 +97,9 @@ impl ResponseStats { | |
| _ if status.is_error() => self.error_map.entry(source).or_default(), | ||
| Status::Ok(_) if self.detailed_stats => self.success_map.entry(source).or_default(), | ||
| Status::Excluded if self.detailed_stats => self.excluded_map.entry(source).or_default(), | ||
| Status::Redirected(_, _) if self.detailed_stats => { | ||
| self.redirect_map.entry(source).or_default() | ||
| } | ||
| _ => return, | ||
| }; | ||
| status_map_entry.insert(response.1); | ||
|
|
@@ -110,7 +115,7 @@ impl ResponseStats { | |
| #[inline] | ||
| /// Check if the entire run was successful | ||
| pub(crate) const fn is_success(&self) -> bool { | ||
| self.total == self.successful + self.excludes + self.unsupported | ||
| self.total == self.successful + self.excludes + self.unsupported + self.redirects | ||
| } | ||
|
|
||
| #[inline] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.