http-2-next 0.5.1 → 1.0.0
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/base64.rb +37 -0
- data/lib/http/2/next/error.rb +1 -1
- data/lib/http/2/next/extensions.rb +0 -16
- data/lib/http/2/next/header/encoding_context.rb +0 -2
- data/lib/http/2/next/server.rb +0 -1
- data/lib/http/2/next/version.rb +1 -1
- data/lib/http/2/next.rb +1 -0
- data/sig/connection.rbs +26 -3
- data/sig/error.rbs +33 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 910d4e858a63a1b882621dbf2951f2f8a20c29be458de15c9633b451594b797a
|
4
|
+
data.tar.gz: a2ab88e4f38a97320f0d338c149485ee5976645fccd110bd839ba96d6f59432f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72ca980c5aa292e4e92cdf625f8769c77a2a12a9452736a254c668f55cfcdcdcde493db0d8e760eb7d4c1981aadbcdb08f0f48970b8453b3a59dbb5c9ef2a614
|
7
|
+
data.tar.gz: 6875ba9d1136b4c146e89c1b5dad811e4225adb03f99340b09dab0a54f7eeee4aab04596e9bed9f1d68de6b2770aa1548a662d4c9969356612ede4c5d48c2864
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
if RUBY_VERSION < "3.3.0"
|
4
|
+
require "base64"
|
5
|
+
elsif !defined?(Base64)
|
6
|
+
module HTTP2Next
|
7
|
+
# require "base64" will not be a default gem after ruby 3.4.0
|
8
|
+
module Base64
|
9
|
+
module_function
|
10
|
+
|
11
|
+
def encode64(bin)
|
12
|
+
[bin].pack("m")
|
13
|
+
end
|
14
|
+
|
15
|
+
def decode64(str)
|
16
|
+
str.unpack1("m")
|
17
|
+
end
|
18
|
+
|
19
|
+
def urlsafe_encode64(bin, padding: true)
|
20
|
+
str = strict_encode64(bin)
|
21
|
+
str.chomp!("==") or str.chomp!("=") unless padding
|
22
|
+
str.tr!("+/", "-_")
|
23
|
+
str
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def urlsafe_decode64(str)
|
28
|
+
if !str.end_with?("=") && str.length % 4 != 0
|
29
|
+
str = str.ljust((str.length + 3) & ~3, "=")
|
30
|
+
str.tr!("-_", "+/")
|
31
|
+
else
|
32
|
+
str = str.tr("-_", "+/")
|
33
|
+
end
|
34
|
+
strict_decode64(str)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/http/2/next/error.rb
CHANGED
@@ -1,16 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module HTTP2Next
|
4
|
-
module RegexpExtensions
|
5
|
-
unless Regexp.method_defined?(:match?)
|
6
|
-
refine Regexp do
|
7
|
-
def match?(*args)
|
8
|
-
!match(*args).nil?
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
4
|
module StringExtensions
|
15
5
|
refine String do
|
16
6
|
def read(n)
|
@@ -29,12 +19,6 @@ module HTTP2Next
|
|
29
19
|
def shift_byte
|
30
20
|
read(1).ord
|
31
21
|
end
|
32
|
-
|
33
|
-
unless String.method_defined?(:unpack1)
|
34
|
-
def unpack1(format)
|
35
|
-
unpack(format).first
|
36
|
-
end
|
37
|
-
end
|
38
22
|
end
|
39
23
|
end
|
40
24
|
end
|
data/lib/http/2/next/server.rb
CHANGED
data/lib/http/2/next/version.rb
CHANGED
data/lib/http/2/next.rb
CHANGED
data/sig/connection.rbs
CHANGED
@@ -21,6 +21,29 @@ module HTTP2Next
|
|
21
21
|
|
22
22
|
attr_writer max_streams: Integer?
|
23
23
|
|
24
|
+
@stream_id: Integer
|
25
|
+
@active_stream_count: Integer
|
26
|
+
@last_activated_stream: Integer
|
27
|
+
@last_stream_id: Integer
|
28
|
+
|
29
|
+
@streams: Hash[Integer, Stream]
|
30
|
+
@streams_recently_closed: Hash[Integer, Stream]
|
31
|
+
|
32
|
+
@framer: Framer
|
33
|
+
|
34
|
+
@local_window_limit: Integer
|
35
|
+
@remote_window_limit: Integer
|
36
|
+
|
37
|
+
@compressor: Header::Compressor
|
38
|
+
@decompressor: Header::Decompressor
|
39
|
+
@error: Symbol?
|
40
|
+
|
41
|
+
@recv_buffer: String
|
42
|
+
@continuation: Array[frame]
|
43
|
+
|
44
|
+
@closed_since: Float?
|
45
|
+
@received_frame: bool
|
46
|
+
|
24
47
|
def closed?: () -> bool
|
25
48
|
|
26
49
|
def new_stream: (**untyped) -> Stream
|
@@ -37,9 +60,9 @@ module HTTP2Next
|
|
37
60
|
def receive: (string data) -> void
|
38
61
|
alias << receive
|
39
62
|
|
40
|
-
|
63
|
+
def initialize: (?settings_hash) -> void
|
41
64
|
|
42
|
-
|
65
|
+
private
|
43
66
|
|
44
67
|
def send: (frame) -> void
|
45
68
|
|
@@ -67,6 +90,6 @@ module HTTP2Next
|
|
67
90
|
|
68
91
|
def _verify_pseudo_headers: (frame, Array[String]) -> void
|
69
92
|
|
70
|
-
def connection_error: (?Symbol error, ?msg: String
|
93
|
+
def connection_error: (?Symbol error, ?msg: String?, ?e: StandardError?) -> void
|
71
94
|
end
|
72
95
|
end
|
data/sig/error.rbs
CHANGED
@@ -1,2 +1,35 @@
|
|
1
1
|
module HTTP2Next
|
2
|
+
module Error
|
3
|
+
def self?.types: () -> Hash[Symbol, singleton(Error)]
|
4
|
+
|
5
|
+
class Error < StandardError
|
6
|
+
end
|
7
|
+
|
8
|
+
class HandshakeError < Error
|
9
|
+
end
|
10
|
+
|
11
|
+
class ProtocolError < Error
|
12
|
+
end
|
13
|
+
|
14
|
+
class CompressionError < ProtocolError
|
15
|
+
end
|
16
|
+
|
17
|
+
class FlowControlError < ProtocolError
|
18
|
+
end
|
19
|
+
|
20
|
+
class InternalError < ProtocolError
|
21
|
+
end
|
22
|
+
|
23
|
+
class StreamClosed < Error
|
24
|
+
end
|
25
|
+
|
26
|
+
class ConnectionClosed < Error
|
27
|
+
end
|
28
|
+
|
29
|
+
class StreamLimitExceeded < Error
|
30
|
+
end
|
31
|
+
|
32
|
+
class FrameSizeError < Error
|
33
|
+
end
|
34
|
+
end
|
2
35
|
end
|
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.
|
4
|
+
version: 1.0.0
|
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:
|
13
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Pure-ruby HTTP 2.0 protocol implementation
|
16
16
|
email:
|
@@ -21,6 +21,7 @@ extra_rdoc_files: []
|
|
21
21
|
files:
|
22
22
|
- README.md
|
23
23
|
- lib/http/2/next.rb
|
24
|
+
- lib/http/2/next/base64.rb
|
24
25
|
- lib/http/2/next/client.rb
|
25
26
|
- lib/http/2/next/connection.rb
|
26
27
|
- lib/http/2/next/emitter.rb
|
@@ -70,14 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
71
|
requirements:
|
71
72
|
- - ">="
|
72
73
|
- !ruby/object:Gem::Version
|
73
|
-
version: 2.
|
74
|
+
version: 2.7.0
|
74
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
76
|
requirements:
|
76
77
|
- - ">="
|
77
78
|
- !ruby/object:Gem::Version
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
|
-
rubygems_version: 3.
|
81
|
+
rubygems_version: 3.4.10
|
81
82
|
signing_key:
|
82
83
|
specification_version: 4
|
83
84
|
summary: Pure-ruby HTTP 2.0 protocol implementation
|