-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
core(robots): use new fetcher to get robots.txt #12423
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
217d2d1
start
adamraine f4c9223
Merge branch 'master' into robots-fetcher
adamraine a28b66c
update smoke
adamraine 362cd60
tests
adamraine 4581bb7
fix smoke
adamraine 0fa55a3
pr
adamraine b444e9d
Merge branch 'master' into robots-fetcher
adamraine aa0eafa
case
adamraine 50a145d
Merge branch 'master' into robots-fetcher
adamraine f41b130
catch
adamraine 2b28dde
wow nice one
adamraine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used
null
to match the expectations of theRobotsTxt
artifact. I thinknull
makes more sense thanundefined
but it leads to some ugly code like this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have had 3 different versions of a comment written here in various tabs that I've lost with varying levels of concern, but at this point it just SGTM 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are the failure cases?
ERR_BLOCKED_BY_CLIENT
? Issuccess
set bynetError
and error status codes, or justnetError
? If it's justnetError
, maybe we should mimic realfetch()
and throw in that case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In one iteration of my comment, I discuss with my lost tab that it seems odd that we would throw an exception rather than a warning on notApplicable. It's not a bug, but rather a known edge case, so the new
null
behavior makes more sense. That does suggest we actually make it a warning in RobotsTxt audit.I'm fine with maintaining the status quo as well and throwing if others prefer that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was thinking in terms of
fetcher
on its own. The gatherer could then do as it saw fit with the responseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
success
is set tofalse
for error status codes, and there is no stream handle to use if content is served wit an error status code.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that seems like a CDP bug but probably not one worth pursuing until we have a reason to want to look at response bodies from requests that 404 or whatever :)
I think it still could make sense for fetcher to return
Promise.resolve({status: number, content: string})
Promise.resolve({status: number, content: null})
Promise.reject(new Error(netErrorName))
(and e.g. the
RobotsTxt
gatherer could catch the error and augment the artifact with a failure reason to add to the auditexplanation
string)but I don't think this is critical today, so I'm fine with this version as well.