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 +4 -4
- data/.travis.yml +1 -0
- data/Gemfile +0 -5
- data/README.md +1 -1
- data/lib/protocol/http1/body/chunked.rb +13 -7
- data/lib/protocol/http1/body/fixed.rb +1 -1
- data/lib/protocol/http1/connection.rb +1 -1
- data/lib/protocol/http1/version.rb +1 -1
- data/protocol-http1.gemspec +2 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62f627bcb79ea69ffb6e8c4aef117cb467a248e30de49fc71ecbde19a9ea7efc
|
4
|
+
data.tar.gz: 0f989b969a3242abe794e8ade640d65cdc1c08730e8f04e40bdf073cda02139f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ed83781ae2acf812f07182a16581067e929f5faa9bccaa5265a265919c02c30efcaecd97ece717b11b4a370fd948720ea20ef82fd27dae4d57683266507b8e
|
7
|
+
data.tar.gz: 5ef114c31372b9058f4daae3962286d4afd60188736c0fa2726fb73d420c54cb54992ea1d3a8637d05c939f8da8229371a44a8068549f2cf37d02aad2cdfe746
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
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://
|
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(
|
29
|
-
@
|
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
|
-
@
|
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 =
|
53
|
+
length = read_line.to_i(16)
|
54
54
|
|
55
55
|
if length == 0
|
56
56
|
@finished = true
|
57
|
-
|
57
|
+
read_line
|
58
58
|
|
59
59
|
return nil
|
60
60
|
end
|
61
61
|
|
62
|
-
chunk = @
|
63
|
-
|
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
|
data/protocol-http1.gemspec
CHANGED
@@ -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.
|
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-
|
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
|