curlyrest 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37d6a70aaee46b5ea7ba47b7ba33dbe460756266
4
- data.tar.gz: 808debe980d36d816fbd6b8309a68d1b19d144b8
3
+ metadata.gz: 6c791b7fd11f32fcb9586ac3efbe1d61c90034a4
4
+ data.tar.gz: d1012f06a4a2a0175a59b794f59f91b27d289708
5
5
  SHA512:
6
- metadata.gz: a1ac14d5d3bc43dbd024eb7188f777428492ab5d217b5268579734bb95bae1d883b58d648263082c5975beaf83def703e74dbdcc21caf80ce9285c71d439899c
7
- data.tar.gz: 86af209813ab08fa35d0a8f21350f56cdba961c5851ac5ffdccccf7118a6e6afdf2b487cc40be156f0a3a4b67313459d00fe7073e67c2d60c95348caa5c0ad6d
6
+ metadata.gz: 6cb1d4ee7bd9b154e8ddadd915cec6f691b223c20c68bdd691336d4e40c82bd19d0286aec073b31fb2f7e0447684dac454913168282b0660322bb6468188f54c
7
+ data.tar.gz: 4df68565566d8c126e1270bba6be462e24aa13a6ccac4cab31954db013fadc01441b8e7b8220e4003efc189ebc5740cda8a4d158ac3ab49238f6ed293b23e8b2
@@ -1,3 +1,3 @@
1
1
  module Curlyrest
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
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.each_line do |l|
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(l)
34
- n = CurlResponse.new(rem[1], rem[2], rem[3].chop)
35
- t = :headers unless rem[2] == 100
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(l)
45
+ if /^[\r\n]+$/.match(lines[i])
38
46
  t = :body
39
47
  else
40
- rem = /^([\w-]+):\s(.*)/.match(l.chop)
48
+ rem = /^([\w-]+):\s(.*)/.match(lines[i].chop)
41
49
  n[rem[1]] = rem[2]
42
50
  end
43
51
  when :body
44
- body << l
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.10
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-05 00:00:00.000000000 Z
11
+ date: 2018-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler