fizx-robots 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/robots.rb +4 -3
- metadata +1 -1
data/lib/robots.rb
CHANGED
@@ -3,9 +3,10 @@ require "uri"
|
|
3
3
|
class Robots
|
4
4
|
class ParsedRobots
|
5
5
|
def initialize(uri)
|
6
|
-
io = open(URI.join(uri.to_s, "/robots.txt"))
|
7
|
-
|
8
|
-
|
6
|
+
io = open(URI.join(uri.to_s, "/robots.txt")) rescue nil
|
7
|
+
if !io || io.content_type != "text/plain" || io.status != ["200", "OK"]
|
8
|
+
io = StringIO.new("User-agent: *\nAllow: /\n")
|
9
|
+
end
|
9
10
|
|
10
11
|
@other = {}
|
11
12
|
@disallows = {}
|