Skip to content
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

Make parsing of robots.txt more resilient #407

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alex-ball
Copy link
Contributor

The code for parsing robots.txt introduced in commit 336f693 can run into problems if the content is not in the right form:

  • If the file is empty, so too will be @lines, so lc will throw an uninitialized value warning at line 84.
  • If the file does not contain a "User-agent: *" line, the code will get stuck in an infinite loop.
  • If the file does not contain blank line after "User-agent: *", the pattern match at line 89 will throw an uninitialized value warning when the loop terminates.

These problems are resolved in this commit.

The code for parsing robots.txt introduced in commit 336f693 can run
into problems if the content is not in the right form:

- If the file is empty, so too will be `@lines`, so `lc` will throw an
  uninitialized value warning at line 84.
- If the file does not contain a "User-agent: *" line the code will get
  stuck in an infinite loop.
- If the file does not contain blank line after "User-agent: *", the
  pattern match at line 89 will throw an uninitialized value warning
  when the loop terminates.

These problems are resolved in this commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant