protocol-http1 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of protocol-http1 might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d23c921f561f2f7a6fb58631aaf830f8e4af6f7256021daa5adc9882f1666431
4
- data.tar.gz: 1852cbee0e400253d31954a50a756e130843e71fabf513f7f5c0027e2676d153
3
+ metadata.gz: 62f627bcb79ea69ffb6e8c4aef117cb467a248e30de49fc71ecbde19a9ea7efc
4
+ data.tar.gz: 0f989b969a3242abe794e8ade640d65cdc1c08730e8f04e40bdf073cda02139f
5
5
  SHA512:
6
- metadata.gz: b7828fd257625dcf05e8336915425d0be741c773dec2f41966d9c4425431b1631d0f241526579d29c4d2bfa86467727d2aa4cba2b9a8ee3028a65288ed2fc9f2
7
- data.tar.gz: 8576793707526a79260c8d24f9d18d283e3c90e8c17a8cf8f48ba7a14bf5fd014675e85db923d3bca44e79fc7b9fecc114dc98396ca84806b4e32391eda11355
6
+ metadata.gz: 19ed83781ae2acf812f07182a16581067e929f5faa9bccaa5265a265919c02c30efcaecd97ece717b11b4a370fd948720ea20ef82fd27dae4d57683266507b8e
7
+ data.tar.gz: 5ef114c31372b9058f4daae3962286d4afd60188736c0fa2726fb73d420c54cb54992ea1d3a8637d05c939f8da8229371a44a8068549f2cf37d02aad2cdfe746
@@ -4,6 +4,7 @@ cache: bundler
4
4
 
5
5
  matrix:
6
6
  include:
7
+ - rvm: 2.3
7
8
  - rvm: 2.4
8
9
  - rvm: 2.5
9
10
  - rvm: 2.6
data/Gemfile CHANGED
@@ -2,8 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in protocol-http1.gemspec
4
4
  gemspec
5
-
6
- group :test do
7
- gem 'async-io'
8
- gem 'async-rspec'
9
- end
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Provides a low-level implementation of the HTTP/1 protocol.
4
4
 
5
- [![Build Status](https://secure.travis-ci.com/socketry/protocol-http1.svg)](http://travis-ci.com/socketry/protocol-http1)
5
+ [![Build Status](https://travis-ci.com/socketry/protocol-http1.svg?branch=master)](https://travis-ci.com/socketry/protocol-http1)
6
6
 
7
7
  ## Installation
8
8
 
@@ -25,8 +25,8 @@ module Protocol
25
25
  module Body
26
26
  class Chunked < HTTP::Body::Readable
27
27
  # TODO maybe this should take a stream rather than a connection?
28
- def initialize(connection)
29
- @connection = connection
28
+ def initialize(stream)
29
+ @stream = stream
30
30
  @finished = false
31
31
 
32
32
  @length = 0
@@ -40,7 +40,7 @@ module Protocol
40
40
  def close(error = nil)
41
41
  # We only close the connection if we haven't completed reading the entire body:
42
42
  unless @finished
43
- @connection.close
43
+ @stream.close
44
44
  @finished = true
45
45
  end
46
46
 
@@ -50,17 +50,17 @@ module Protocol
50
50
  def read
51
51
  return nil if @finished
52
52
 
53
- length = @connection.read_line.to_i(16)
53
+ length = read_line.to_i(16)
54
54
 
55
55
  if length == 0
56
56
  @finished = true
57
- @connection.read_line
57
+ read_line
58
58
 
59
59
  return nil
60
60
  end
61
61
 
62
- chunk = @connection.stream.read(length)
63
- @connection.read_line # Consume the trailing CRLF
62
+ chunk = @stream.read(length)
63
+ read_line # Consume the trailing CRLF
64
64
 
65
65
  @length += length
66
66
  @count += 1
@@ -71,6 +71,12 @@ module Protocol
71
71
  def inspect
72
72
  "\#<#{self.class} #{@length} bytes read in #{@count} chunks>"
73
73
  end
74
+
75
+ private
76
+
77
+ def read_line
78
+ @stream.gets(chomp: true)
79
+ end
74
80
  end
75
81
  end
76
82
  end
@@ -47,7 +47,7 @@ module Protocol
47
47
 
48
48
  def read
49
49
  if @remaining > 0
50
- if chunk = @stream.read_partial(@remaining)
50
+ if chunk = @stream.readpartial(@remaining)
51
51
  @remaining -= chunk.bytesize
52
52
 
53
53
  return chunk
@@ -312,7 +312,7 @@ module Protocol
312
312
  end
313
313
 
314
314
  def read_chunked_body
315
- Body::Chunked.new(self)
315
+ Body::Chunked.new(@stream)
316
316
  end
317
317
 
318
318
  def read_fixed_body(length)
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Protocol
22
22
  module HTTP1
23
- VERSION = "0.8.2"
23
+ VERSION = "0.8.3"
24
24
  end
25
25
  end
@@ -24,4 +24,6 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "rspec-memory", "~> 1.0"
28
+ spec.add_development_dependency "rspec-files", "~> 1.0"
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-23 00:00:00.000000000 Z
11
+ date: 2019-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protocol-http
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-memory
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-files
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.0'
83
111
  description:
84
112
  email:
85
113
  - samuel.williams@oriontransfer.co.nz