iconoclasm 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/iconoclasm/extractor.rb +1 -1
- data/lib/iconoclasm/headers.rb +9 -8
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/iconoclasm/extractor.rb
CHANGED
data/lib/iconoclasm/headers.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
module Iconoclasm
|
2
2
|
class Headers
|
3
|
-
|
3
|
+
REGEXP = /^\s*HTTP\/(\d\.\d)\s*(\d{3})\s*(.*)\s*$/i
|
4
|
+
|
4
5
|
attr_reader :version, :code, :message
|
5
6
|
|
6
|
-
def initialize(
|
7
|
-
|
8
|
-
|
7
|
+
def initialize(string)
|
8
|
+
header_string = string.dup
|
9
|
+
http_response = header_string.slice!(REGEXP)
|
10
|
+
@version, @code, @message = parse_http_response(http_response.strip)
|
11
|
+
@header_hash = parse_header_string(header_string.strip)
|
9
12
|
end
|
10
13
|
|
11
14
|
def [](header)
|
@@ -47,10 +50,8 @@ module Iconoclasm
|
|
47
50
|
end
|
48
51
|
|
49
52
|
def parse_http_response(response)
|
50
|
-
if response.match(
|
51
|
-
|
52
|
-
@code = $2.to_i
|
53
|
-
@message = $3.strip
|
53
|
+
if response.match(REGEXP || "")
|
54
|
+
[ $1.to_f, $2.to_i, $3.chomp.strip ]
|
54
55
|
else
|
55
56
|
raise Iconoclasm::HTTPError.new(nil, response)
|
56
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iconoclasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sander Hartlage
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-07 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|