http-2 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/lib/http/2/buffer.rb +6 -4
- data/lib/http/2/client.rb +5 -1
- data/lib/http/2/compressor.rb +42 -34
- data/lib/http/2/connection.rb +72 -86
- data/lib/http/2/emitter.rb +4 -1
- data/lib/http/2/error.rb +2 -0
- data/lib/http/2/flow_buffer.rb +8 -3
- data/lib/http/2/framer.rb +83 -94
- data/lib/http/2/huffman.rb +19 -17
- data/lib/http/2/server.rb +9 -7
- data/lib/http/2/stream.rb +48 -48
- data/lib/http/2/version.rb +3 -1
- data/lib/http/2.rb +2 -0
- metadata +7 -60
- data/.autotest +0 -20
- data/.coveralls.yml +0 -1
- data/.gitignore +0 -20
- data/.gitmodules +0 -3
- data/.rspec +0 -5
- data/.rubocop.yml +0 -93
- data/.rubocop_todo.yml +0 -131
- data/.travis.yml +0 -17
- data/Gemfile +0 -16
- data/Guardfile +0 -18
- data/Guardfile.h2spec +0 -12
- data/Rakefile +0 -49
- data/example/Gemfile +0 -3
- data/example/README.md +0 -44
- data/example/client.rb +0 -122
- data/example/helper.rb +0 -19
- data/example/keys/server.crt +0 -20
- data/example/keys/server.key +0 -27
- data/example/server.rb +0 -139
- data/example/upgrade_client.rb +0 -153
- data/example/upgrade_server.rb +0 -203
- data/http-2.gemspec +0 -22
- data/lib/tasks/generate_huffman_table.rb +0 -166
- data/spec/buffer_spec.rb +0 -28
- data/spec/client_spec.rb +0 -188
- data/spec/compressor_spec.rb +0 -666
- data/spec/connection_spec.rb +0 -681
- data/spec/emitter_spec.rb +0 -54
- data/spec/framer_spec.rb +0 -487
- data/spec/h2spec/h2spec.darwin +0 -0
- data/spec/h2spec/output/non_secure.txt +0 -317
- data/spec/helper.rb +0 -147
- data/spec/hpack_test_spec.rb +0 -84
- data/spec/huffman_spec.rb +0 -68
- data/spec/server_spec.rb +0 -52
- data/spec/stream_spec.rb +0 -878
- data/spec/support/deep_dup.rb +0 -55
- data/spec/support/duplicable.rb +0 -98
data/spec/support/deep_dup.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
# https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/object/deep_dup.rb
|
2
|
-
|
3
|
-
require_relative 'duplicable'
|
4
|
-
|
5
|
-
class Object
|
6
|
-
# Returns a deep copy of object if it's duplicable. If it's
|
7
|
-
# not duplicable, returns +self+.
|
8
|
-
#
|
9
|
-
# object = Object.new
|
10
|
-
# dup = object.deep_dup
|
11
|
-
# dup.instance_variable_set(:@a, 1)
|
12
|
-
#
|
13
|
-
# object.instance_variable_defined?(:@a) # => false
|
14
|
-
# dup.instance_variable_defined?(:@a) # => true
|
15
|
-
def deep_dup
|
16
|
-
duplicable? ? dup : self
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class Array
|
21
|
-
# Returns a deep copy of array.
|
22
|
-
#
|
23
|
-
# array = [1, [2, 3]]
|
24
|
-
# dup = array.deep_dup
|
25
|
-
# dup[1][2] = 4
|
26
|
-
#
|
27
|
-
# array[1][2] # => nil
|
28
|
-
# dup[1][2] # => 4
|
29
|
-
def deep_dup
|
30
|
-
map(&:deep_dup)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class Hash
|
35
|
-
# Returns a deep copy of hash.
|
36
|
-
#
|
37
|
-
# hash = { a: { b: 'b' } }
|
38
|
-
# dup = hash.deep_dup
|
39
|
-
# dup[:a][:c] = 'c'
|
40
|
-
#
|
41
|
-
# hash[:a][:c] # => nil
|
42
|
-
# dup[:a][:c] # => "c"
|
43
|
-
def deep_dup
|
44
|
-
hash = dup
|
45
|
-
each_pair do |key, value|
|
46
|
-
if key.frozen? && ::String == key # changed === to == for rubocop
|
47
|
-
hash[key] = value.deep_dup
|
48
|
-
else
|
49
|
-
hash.delete(key)
|
50
|
-
hash[key.deep_dup] = value.deep_dup
|
51
|
-
end
|
52
|
-
end
|
53
|
-
hash
|
54
|
-
end
|
55
|
-
end
|
data/spec/support/duplicable.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Most objects are cloneable, but not all. For example you can't dup +nil+:
|
3
|
-
#
|
4
|
-
# nil.dup # => TypeError: can't dup NilClass
|
5
|
-
#
|
6
|
-
# Classes may signal their instances are not duplicable removing +dup+/+clone+
|
7
|
-
# or raising exceptions from them. So, to dup an arbitrary object you normally
|
8
|
-
# use an optimistic approach and are ready to catch an exception, say:
|
9
|
-
#
|
10
|
-
# arbitrary_object.dup rescue object
|
11
|
-
#
|
12
|
-
# Rails dups objects in a few critical spots where they are not that arbitrary.
|
13
|
-
# That rescue is very expensive (like 40 times slower than a predicate), and it
|
14
|
-
# is often triggered.
|
15
|
-
#
|
16
|
-
# That's why we hardcode the following cases and check duplicable? instead of
|
17
|
-
# using that rescue idiom.
|
18
|
-
#++
|
19
|
-
class Object
|
20
|
-
# Can you safely dup this object?
|
21
|
-
#
|
22
|
-
# False for +nil+, +false+, +true+, symbol, number, method objects;
|
23
|
-
# true otherwise.
|
24
|
-
def duplicable?
|
25
|
-
true
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class NilClass
|
30
|
-
# +nil+ is not duplicable:
|
31
|
-
#
|
32
|
-
# nil.duplicable? # => false
|
33
|
-
# nil.dup # => TypeError: can't dup NilClass
|
34
|
-
def duplicable?
|
35
|
-
false
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
class FalseClass
|
40
|
-
# +false+ is not duplicable:
|
41
|
-
#
|
42
|
-
# false.duplicable? # => false
|
43
|
-
# false.dup # => TypeError: can't dup FalseClass
|
44
|
-
def duplicable?
|
45
|
-
false
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
class TrueClass
|
50
|
-
# +true+ is not duplicable:
|
51
|
-
#
|
52
|
-
# true.duplicable? # => false
|
53
|
-
# true.dup # => TypeError: can't dup TrueClass
|
54
|
-
def duplicable?
|
55
|
-
false
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Symbol
|
60
|
-
# Symbols are not duplicable:
|
61
|
-
#
|
62
|
-
# :my_symbol.duplicable? # => false
|
63
|
-
# :my_symbol.dup # => TypeError: can't dup Symbol
|
64
|
-
def duplicable?
|
65
|
-
false
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
class Numeric
|
70
|
-
# Numbers are not duplicable:
|
71
|
-
#
|
72
|
-
# 3.duplicable? # => false
|
73
|
-
# 3.dup # => TypeError: can't dup Integer
|
74
|
-
def duplicable?
|
75
|
-
false
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
require 'bigdecimal'
|
80
|
-
class BigDecimal
|
81
|
-
# BigDecimals are duplicable:
|
82
|
-
#
|
83
|
-
# BigDecimal.new("1.2").duplicable? # => true
|
84
|
-
# BigDecimal.new("1.2").dup # => #<BigDecimal:...,'0.12E1',18(18)>
|
85
|
-
def duplicable?
|
86
|
-
true
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
class Method
|
91
|
-
# Methods are not duplicable:
|
92
|
-
#
|
93
|
-
# method(:puts).duplicable? # => false
|
94
|
-
# method(:puts).dup # => TypeError: allocator undefined for Method
|
95
|
-
def duplicable?
|
96
|
-
false
|
97
|
-
end
|
98
|
-
end
|