curlyrest 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/curlyrest/version.rb +1 -1
- data/lib/curlyrest.rb +16 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c791b7fd11f32fcb9586ac3efbe1d61c90034a4
|
4
|
+
data.tar.gz: d1012f06a4a2a0175a59b794f59f91b27d289708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb1d4ee7bd9b154e8ddadd915cec6f691b223c20c68bdd691336d4e40c82bd19d0286aec073b31fb2f7e0447684dac454913168282b0660322bb6468188f54c
|
7
|
+
data.tar.gz: 4df68565566d8c126e1270bba6be462e24aa13a6ccac4cab31954db013fadc01441b8e7b8220e4003efc189ebc5740cda8a4d158ac3ab49238f6ed293b23e8b2
|
data/lib/curlyrest/version.rb
CHANGED
data/lib/curlyrest.rb
CHANGED
@@ -27,22 +27,31 @@ module Curlyrest
|
|
27
27
|
t = :http_status
|
28
28
|
n = nil
|
29
29
|
body = ''
|
30
|
-
r.
|
30
|
+
lines = r.lines
|
31
|
+
i = 0
|
32
|
+
while (i < lines.length)
|
31
33
|
case t
|
32
34
|
when :http_status
|
33
|
-
rem = /^HTTP\/(\d+\.\d+) (\d+) (.+)$/.match(
|
34
|
-
|
35
|
-
|
35
|
+
rem = /^HTTP\/(\d+\.\d+) (\d+) (.+)$/.match(lines[i])
|
36
|
+
if rem[2] == '100'
|
37
|
+
t = :wait_for_another_http
|
38
|
+
else
|
39
|
+
t = :headers
|
40
|
+
n = CurlResponse.new(rem[1], rem[2], rem[3].chop)
|
41
|
+
end
|
42
|
+
when :wait_for_another_http
|
43
|
+
t = :http_status if rem = /^HTTP\/(\d+\.\d+) (\d+) (.+)$/.match(lines[i+1])
|
36
44
|
when :headers
|
37
|
-
if /^[\r\n]+$/.match(
|
45
|
+
if /^[\r\n]+$/.match(lines[i])
|
38
46
|
t = :body
|
39
47
|
else
|
40
|
-
rem = /^([\w-]+):\s(.*)/.match(
|
48
|
+
rem = /^([\w-]+):\s(.*)/.match(lines[i].chop)
|
41
49
|
n[rem[1]] = rem[2]
|
42
50
|
end
|
43
51
|
when :body
|
44
|
-
body <<
|
52
|
+
body << lines[i]
|
45
53
|
end
|
54
|
+
i += 1
|
46
55
|
end
|
47
56
|
if n.to_hash.keys && n.to_hash.keys.include?('content-encoding') &&
|
48
57
|
n.to_hash['content-encoding'].include?('gzip')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curlyrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keith Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|