Repository navigation
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Crawl-delayandRequest-ratelines currently end a group, so inthe
Disallowrule only applies to OtherBot. RFC 9309, section 2.2.4, says records like these must not end a group, which is howSitemapis already handled.Just leaving the state unchanged fixes the rules, but it also merges the delays. Many sites give each bot its own delay in blocks like the one above (eff.org, moodle.org and vimeo.com, for example), and the last
Crawl-delayin the merged group would then override the others. On eff.org, CCBot's delay would drop from 60 to 30. So instead, aUser-agentline afterCrawl-delayorRequest-ratestarts a new entry in the same group. The rules are shared by the whole group, and each delay and rate stays with the user agents listed directly above it, as before.How I checked it:
mainand pass with the change.crawl_delay()andrequest_rate()return the same values as before, andcan_fetch()matches the old parser on the same file with theCrawl-delayandRequest-ratelines removed. I compared all 271,452 files of up to 5 lines built from user-agent, allow, disallow, crawl-delay, request-rate, sitemap and unknown lines, plus 100,000 random longer files. The only differences were 36 cases where the user agent matches a group only as a substring (likeGooglebot-Imageand aGooglebotgroup). In each of them the new result comes from that agent's merged group, which the old code missed.can_fetch()changes for some agents in 34 files, which is the fix. No crawl delay or request rate changes.