Skip to content

Commit dafd788

Browse files
author
Brent Cook
committed
Fixing mix case of user-agent.
From bfbe173cd6bf91be477ef0affc2c4c86ca75bc1d Mon Sep 17 00:00:00 2001 From: Jason Kim <[email protected]> Date: Thu, 3 Nov 2011 15:43:14 -0700 Subject: [PATCH 1/2] Fixing mix case of user-agent. Adding/Fixing test.
1 parent 928d632 commit dafd788

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/robots.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ def initialize(uri, user_agent)
2626
io.each do |line|
2727
next if line =~ /^\s*(#.*|$)/
2828
arr = line.split(":")
29-
key = arr.shift
29+
key = arr.shift.to_s.downcase
3030
value = arr.join(":").strip
3131
value.strip!
3232
case key
33-
when "User-agent"
33+
when "user-agent"
3434
agent = to_regex(value)
35-
when "Allow"
35+
when "allow"
3636
@allows[agent] ||= []
3737
@allows[agent] << to_regex(value)
38-
when "Disallow"
38+
when "disallow"
3939
@disallows[agent] ||= []
4040
@disallows[agent] << to_regex(value)
41-
when "Crawl-delay"
41+
when "crawl-delay"
4242
@delays[agent] = value.to_i
4343
else
4444
@other[key] ||= []

0 commit comments

Comments
 (0)