http-2 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +18 -0
- data/.rubocop_todo.yml +46 -0
- data/.travis.yml +10 -2
- data/Gemfile +7 -5
- data/README.md +35 -37
- data/Rakefile +9 -10
- data/example/README.md +0 -13
- data/example/client.rb +12 -15
- data/example/helper.rb +2 -2
- data/example/server.rb +19 -19
- data/example/upgrade_server.rb +191 -0
- data/http-2.gemspec +10 -9
- data/lib/http/2.rb +13 -13
- data/lib/http/2/buffer.rb +6 -10
- data/lib/http/2/client.rb +5 -10
- data/lib/http/2/compressor.rb +134 -146
- data/lib/http/2/connection.rb +104 -100
- data/lib/http/2/emitter.rb +2 -4
- data/lib/http/2/error.rb +7 -7
- data/lib/http/2/flow_buffer.rb +11 -10
- data/lib/http/2/framer.rb +78 -87
- data/lib/http/2/huffman.rb +265 -274
- data/lib/http/2/huffman_statemachine.rb +257 -257
- data/lib/http/2/server.rb +81 -6
- data/lib/http/2/stream.rb +195 -130
- data/lib/http/2/version.rb +1 -1
- data/lib/tasks/generate_huffman_table.rb +30 -24
- data/spec/buffer_spec.rb +11 -13
- data/spec/client_spec.rb +41 -42
- data/spec/compressor_spec.rb +243 -242
- data/spec/connection_spec.rb +252 -248
- data/spec/emitter_spec.rb +12 -12
- data/spec/framer_spec.rb +177 -179
- data/spec/helper.rb +56 -57
- data/spec/huffman_spec.rb +33 -33
- data/spec/server_spec.rb +15 -15
- data/spec/stream_spec.rb +356 -265
- metadata +7 -6
- data/spec/hpack_test_spec.rb +0 -83
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Grigorik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-12-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -37,6 +37,8 @@ files:
|
|
37
37
|
- ".gitignore"
|
38
38
|
- ".gitmodules"
|
39
39
|
- ".rspec"
|
40
|
+
- ".rubocop.yml"
|
41
|
+
- ".rubocop_todo.yml"
|
40
42
|
- ".travis.yml"
|
41
43
|
- Gemfile
|
42
44
|
- README.md
|
@@ -47,6 +49,7 @@ files:
|
|
47
49
|
- example/keys/mycert.pem
|
48
50
|
- example/keys/mykey.pem
|
49
51
|
- example/server.rb
|
52
|
+
- example/upgrade_server.rb
|
50
53
|
- http-2.gemspec
|
51
54
|
- lib/http/2.rb
|
52
55
|
- lib/http/2/buffer.rb
|
@@ -70,7 +73,6 @@ files:
|
|
70
73
|
- spec/emitter_spec.rb
|
71
74
|
- spec/framer_spec.rb
|
72
75
|
- spec/helper.rb
|
73
|
-
- spec/hpack_test_spec.rb
|
74
76
|
- spec/huffman_spec.rb
|
75
77
|
- spec/server_spec.rb
|
76
78
|
- spec/stream_spec.rb
|
@@ -86,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
88
|
requirements:
|
87
89
|
- - ">="
|
88
90
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
91
|
+
version: 2.0.0
|
90
92
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
93
|
requirements:
|
92
94
|
- - ">="
|
@@ -94,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
96
|
version: '0'
|
95
97
|
requirements: []
|
96
98
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.4.
|
99
|
+
rubygems_version: 2.4.5.1
|
98
100
|
signing_key:
|
99
101
|
specification_version: 4
|
100
102
|
summary: Pure-ruby HTTP 2.0 protocol implementation
|
@@ -106,7 +108,6 @@ test_files:
|
|
106
108
|
- spec/emitter_spec.rb
|
107
109
|
- spec/framer_spec.rb
|
108
110
|
- spec/helper.rb
|
109
|
-
- spec/hpack_test_spec.rb
|
110
111
|
- spec/huffman_spec.rb
|
111
112
|
- spec/server_spec.rb
|
112
113
|
- spec/stream_spec.rb
|
data/spec/hpack_test_spec.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
describe HTTP2::Header do
|
5
|
-
folders = %w[
|
6
|
-
go-hpack
|
7
|
-
haskell-http2-diff
|
8
|
-
haskell-http2-diff-huffman
|
9
|
-
haskell-http2-linear
|
10
|
-
haskell-http2-linear-huffman
|
11
|
-
haskell-http2-naive
|
12
|
-
haskell-http2-naive-huffman
|
13
|
-
haskell-http2-static
|
14
|
-
haskell-http2-static-huffman
|
15
|
-
#hyper-hpack
|
16
|
-
nghttp2
|
17
|
-
nghttp2-16384-4096
|
18
|
-
nghttp2-change-table-size
|
19
|
-
node-http2-hpack
|
20
|
-
]
|
21
|
-
|
22
|
-
context "Decompressor" do
|
23
|
-
folders.each do |folder|
|
24
|
-
next if folder =~ /#/
|
25
|
-
path = File.expand_path("hpack-test-case/#{folder}", File.dirname(__FILE__))
|
26
|
-
Dir.exists?(path) or next
|
27
|
-
context "#{folder}" do
|
28
|
-
Dir.foreach(path) do |file|
|
29
|
-
next if file !~ /\.json/
|
30
|
-
it "should decode #{file}" do
|
31
|
-
story = JSON.parse(File.read("#{path}/#{file}"))
|
32
|
-
cases = story['cases']
|
33
|
-
table_size = cases[0]['header_table_size'] || 4096
|
34
|
-
context = story['context'] ? story['context'].to_sym : :request
|
35
|
-
@dc = Decompressor.new(table_size: table_size)
|
36
|
-
cases.each do |c|
|
37
|
-
wire = [c['wire']].pack("H*").force_encoding('binary')
|
38
|
-
@emitted = @dc.decode(HTTP2::Buffer.new(wire))
|
39
|
-
headers = c['headers'].flat_map(&:to_a)
|
40
|
-
@emitted.should eq headers
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context "Compressor" do
|
49
|
-
%w[
|
50
|
-
LINEAR
|
51
|
-
NAIVE
|
52
|
-
SHORTER
|
53
|
-
STATIC
|
54
|
-
].each do |mode|
|
55
|
-
next if mode =~ /#/
|
56
|
-
['', 'H'].each do |huffman|
|
57
|
-
[4096, 512].each do |table_size|
|
58
|
-
context "with #{mode}#{huffman} mode and table_size #{table_size}" do
|
59
|
-
options = eval("HTTP2::Header::#{mode}#{huffman}")
|
60
|
-
path = File.expand_path("hpack-test-case/raw-data", File.dirname(__FILE__))
|
61
|
-
Dir.foreach(path) do |file|
|
62
|
-
next if file !~ /\.json/
|
63
|
-
it "should encode #{file}" do
|
64
|
-
story = JSON.parse(File.read("#{path}/#{file}"))
|
65
|
-
cases = story['cases']
|
66
|
-
context = story['context'] ? story['context'].to_sym : :request
|
67
|
-
@cc = Compressor .new(table_size: table_size)
|
68
|
-
@dc = Decompressor.new(table_size: table_size)
|
69
|
-
cases.each do |c|
|
70
|
-
headers = c['headers'].flat_map(&:to_a)
|
71
|
-
wire = @cc.encode(headers)
|
72
|
-
decoded = @dc.decode(HTTP2::Buffer.new(wire))
|
73
|
-
decoded.should eq headers
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|