http-2 0.11.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -9
  3. data/lib/http/2/base64.rb +45 -0
  4. data/lib/http/2/client.rb +19 -6
  5. data/lib/http/2/connection.rb +235 -163
  6. data/lib/http/2/emitter.rb +7 -5
  7. data/lib/http/2/error.rb +24 -1
  8. data/lib/http/2/extensions.rb +53 -0
  9. data/lib/http/2/flow_buffer.rb +91 -33
  10. data/lib/http/2/framer.rb +184 -157
  11. data/lib/http/2/header/compressor.rb +157 -0
  12. data/lib/http/2/header/decompressor.rb +144 -0
  13. data/lib/http/2/header/encoding_context.rb +337 -0
  14. data/lib/http/2/{huffman.rb → header/huffman.rb} +25 -19
  15. data/lib/http/2/{huffman_statemachine.rb → header/huffman_statemachine.rb} +2 -0
  16. data/lib/http/2/header.rb +35 -0
  17. data/lib/http/2/server.rb +47 -20
  18. data/lib/http/2/stream.rb +130 -61
  19. data/lib/http/2/version.rb +3 -1
  20. data/lib/http/2.rb +14 -13
  21. data/sig/client.rbs +9 -0
  22. data/sig/connection.rbs +93 -0
  23. data/sig/emitter.rbs +13 -0
  24. data/sig/error.rbs +35 -0
  25. data/sig/extensions.rbs +5 -0
  26. data/sig/flow_buffer.rbs +21 -0
  27. data/sig/frame_buffer.rbs +13 -0
  28. data/sig/framer.rbs +54 -0
  29. data/sig/header/compressor.rbs +27 -0
  30. data/sig/header/decompressor.rbs +22 -0
  31. data/sig/header/encoding_context.rbs +34 -0
  32. data/sig/header/huffman.rbs +9 -0
  33. data/sig/header.rbs +27 -0
  34. data/sig/next.rbs +101 -0
  35. data/sig/server.rbs +12 -0
  36. data/sig/stream.rbs +91 -0
  37. metadata +38 -79
  38. data/.autotest +0 -20
  39. data/.coveralls.yml +0 -1
  40. data/.gitignore +0 -20
  41. data/.gitmodules +0 -3
  42. data/.rspec +0 -5
  43. data/.rubocop.yml +0 -93
  44. data/.rubocop_todo.yml +0 -131
  45. data/.travis.yml +0 -17
  46. data/Gemfile +0 -16
  47. data/Guardfile +0 -18
  48. data/Guardfile.h2spec +0 -12
  49. data/LICENSE +0 -21
  50. data/Rakefile +0 -49
  51. data/example/Gemfile +0 -3
  52. data/example/README.md +0 -44
  53. data/example/client.rb +0 -122
  54. data/example/helper.rb +0 -19
  55. data/example/keys/server.crt +0 -20
  56. data/example/keys/server.key +0 -27
  57. data/example/server.rb +0 -139
  58. data/example/upgrade_client.rb +0 -153
  59. data/example/upgrade_server.rb +0 -203
  60. data/http-2.gemspec +0 -22
  61. data/lib/http/2/buffer.rb +0 -76
  62. data/lib/http/2/compressor.rb +0 -572
  63. data/lib/tasks/generate_huffman_table.rb +0 -166
  64. data/spec/buffer_spec.rb +0 -28
  65. data/spec/client_spec.rb +0 -188
  66. data/spec/compressor_spec.rb +0 -666
  67. data/spec/connection_spec.rb +0 -681
  68. data/spec/emitter_spec.rb +0 -54
  69. data/spec/framer_spec.rb +0 -487
  70. data/spec/h2spec/h2spec.darwin +0 -0
  71. data/spec/h2spec/output/non_secure.txt +0 -317
  72. data/spec/helper.rb +0 -147
  73. data/spec/hpack_test_spec.rb +0 -84
  74. data/spec/huffman_spec.rb +0 -68
  75. data/spec/server_spec.rb +0 -52
  76. data/spec/stream_spec.rb +0 -878
  77. data/spec/support/deep_dup.rb +0 -55
  78. data/spec/support/duplicable.rb +0 -98
@@ -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
@@ -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