summaryrefslogtreecommitdiffstats
path: root/Lib/urllib/robotparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib/robotparser.py')
-rw-r--r--Lib/urllib/robotparser.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/urllib/robotparser.py b/Lib/urllib/robotparser.py
index c55fb50..bafb611 100644
--- a/Lib/urllib/robotparser.py
+++ b/Lib/urllib/robotparser.py
@@ -76,6 +76,10 @@ class RobotFileParser:
We allow that a user-agent: line is not preceded by
one or more blank lines.
"""
+ # states:
+ # 0: start state
+ # 1: saw user-agent line
+ # 2: saw an allow or disallow line
state = 0
entry = Entry()
@@ -112,6 +116,7 @@ class RobotFileParser:
elif line[0] == "allow":
if state != 0:
entry.rulelines.append(RuleLine(line[1], True))
+ state = 2
if state == 2:
self.entries.append(entry)