http-2-next 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http/2/next/client.rb +2 -2
- data/lib/http/2/next/compressor.rb +4 -6
- data/lib/http/2/next/connection.rb +1 -1
- data/lib/http/2/next/framer.rb +1 -3
- data/lib/http/2/next/server.rb +1 -1
- data/lib/http/2/next/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eaeeaa49a752ff95b0cf220cf08a725f471d7b13015e78fb20c5cb2dd73118d
|
4
|
+
data.tar.gz: 67f3a2ff286dd2916f849e60ced05aeff39842feb75f2c2088fc29c177459a92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfcedbd08e28236d673354ed49e2c9bbbd09fa6953775c6a943e9707675fab6eb82133096eb048fffc050f9acf666952b3fb9619c68314e663ac00af2f126c3a
|
7
|
+
data.tar.gz: f87a894094ff8d39dea28fb966e81bcf04dfa4d8cfb4bcf067c103f2dc1a09c82a6a6a0af87558a40cd16ca7f8e5157f9b4fed48cc100bb3578913e210f5ff00
|
data/lib/http/2/next/client.rb
CHANGED
@@ -20,7 +20,7 @@ module HTTP2Next
|
|
20
20
|
#
|
21
21
|
class Client < Connection
|
22
22
|
# Initialize new HTTP 2.0 client object.
|
23
|
-
def initialize(
|
23
|
+
def initialize(settings = {})
|
24
24
|
@stream_id = 1
|
25
25
|
@state = :waiting_connection_preface
|
26
26
|
|
@@ -67,7 +67,7 @@ module HTTP2Next
|
|
67
67
|
settings(payload)
|
68
68
|
end
|
69
69
|
|
70
|
-
def self.settings_header(
|
70
|
+
def self.settings_header(settings)
|
71
71
|
frame = Framer.new.generate(type: :settings, stream: 0, payload: settings)
|
72
72
|
Base64.urlsafe_encode64(frame[9..-1])
|
73
73
|
end
|
@@ -96,7 +96,7 @@ module HTTP2Next
|
|
96
96
|
# :table_size Integer maximum dynamic table size in bytes
|
97
97
|
# :huffman Symbol :always, :never, :shorter
|
98
98
|
# :index Symbol :all, :static, :never
|
99
|
-
def initialize(
|
99
|
+
def initialize(options = {})
|
100
100
|
default_options = {
|
101
101
|
huffman: :shorter,
|
102
102
|
index: :all,
|
@@ -349,7 +349,7 @@ module HTTP2Next
|
|
349
349
|
# Responsible for encoding header key-value pairs using HPACK algorithm.
|
350
350
|
class Compressor
|
351
351
|
# @param options [Hash] encoding options
|
352
|
-
def initialize(
|
352
|
+
def initialize(options = {})
|
353
353
|
@cc = EncodingContext.new(options)
|
354
354
|
end
|
355
355
|
|
@@ -414,9 +414,7 @@ module HTTP2Next
|
|
414
414
|
def string(str)
|
415
415
|
plain = nil
|
416
416
|
huffman = nil
|
417
|
-
unless @cc.options[:huffman] == :always
|
418
|
-
plain = integer(str.bytesize, 7) << str.dup.force_encoding(Encoding::BINARY)
|
419
|
-
end
|
417
|
+
plain = integer(str.bytesize, 7) << str.dup.force_encoding(Encoding::BINARY) unless @cc.options[:huffman] == :always
|
420
418
|
unless @cc.options[:huffman] == :never
|
421
419
|
huffman = Huffman.new.encode(str)
|
422
420
|
huffman = integer(huffman.bytesize, 7) << huffman
|
@@ -491,7 +489,7 @@ module HTTP2Next
|
|
491
489
|
include Error
|
492
490
|
|
493
491
|
# @param options [Hash] decoding options. Only :table_size is effective.
|
494
|
-
def initialize(
|
492
|
+
def initialize(options = {})
|
495
493
|
@cc = EncodingContext.new(options)
|
496
494
|
end
|
497
495
|
|
data/lib/http/2/next/framer.rb
CHANGED
@@ -240,9 +240,7 @@ module HTTP2Next
|
|
240
240
|
length += 4 + frame[:payload].bytesize
|
241
241
|
|
242
242
|
when :ping
|
243
|
-
if frame[:payload].bytesize != 8
|
244
|
-
raise CompressionError, "Invalid payload size (#{frame[:payload].size} != 8 bytes)"
|
245
|
-
end
|
243
|
+
raise CompressionError, "Invalid payload size (#{frame[:payload].size} != 8 bytes)" if frame[:payload].bytesize != 8
|
246
244
|
|
247
245
|
bytes << frame[:payload]
|
248
246
|
length += 8
|
data/lib/http/2/next/server.rb
CHANGED
data/lib/http/2/next/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-2-next
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-12-
|
13
|
+
date: 2019-12-30 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Pure-ruby HTTP 2.0 protocol implementation
|
16
16
|
email:
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubygems_version: 3.
|
57
|
+
rubygems_version: 3.1.2
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: Pure-ruby HTTP 2.0 protocol implementation
|