Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f8ab965
Commit
3f8ab965
authored
Jul 28, 2010
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Issue6325 - robotparse to honor urls with query strings.
parent
96a60ae9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
2 deletions
+15
-2
Lib/test/test_robotparser.py
Lib/test/test_robotparser.py
+11
-0
Lib/urllib/robotparser.py
Lib/urllib/robotparser.py
+4
-2
No files found.
Lib/test/test_robotparser.py
View file @
3f8ab965
...
...
@@ -205,6 +205,17 @@ bad = ['/folder1/anotherfile.html']
RobotTest
(
13
,
doc
,
good
,
bad
,
agent
=
"googlebot"
)
# 14. For issue #6325 (query string support)
doc
=
"""
User-agent: *
Disallow: /some/path?name=value
"""
good
=
[
'/some/path'
]
bad
=
[
'/some/path?name=value'
]
RobotTest
(
14
,
doc
,
good
,
bad
)
class
NetworkTestCase
(
unittest
.
TestCase
):
...
...
Lib/urllib/robotparser.py
View file @
3f8ab965
...
...
@@ -129,8 +129,10 @@ class RobotFileParser:
return
True
# search for given user agent matches
# the first match counts
url
=
urllib
.
parse
.
quote
(
urllib
.
parse
.
urlparse
(
urllib
.
parse
.
unquote
(
url
))[
2
])
parsed_url
=
urllib
.
parse
.
urlparse
(
urllib
.
parse
.
unquote
(
url
))
url
=
urllib
.
parse
.
urlunparse
((
''
,
''
,
parsed_url
.
path
,
parsed_url
.
params
,
parsed_url
.
query
,
parsed_url
.
fragment
))
url
=
urllib
.
parse
.
quote
(
url
)
if
not
url
:
url
=
"/"
for
entry
in
self
.
entries
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment