http-2-next 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/http/2/next/emitter.rb +1 -1
- data/lib/http/2/next/error.rb +4 -1
- data/lib/http/2/next/framer.rb +2 -6
- data/lib/http/2/next/header/compressor.rb +1 -1
- data/lib/http/2/next/header/decompressor.rb +2 -2
- data/lib/http/2/next/header/encoding_context.rb +1 -1
- data/lib/http/2/next/header/huffman.rb +2 -2
- data/lib/http/2/next/stream.rb +4 -5
- data/lib/http/2/next/version.rb +1 -1
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7c15b998344b09aee75566b64f5ef94abb9b388fdc3d2f06704e8263a586789
|
4
|
+
data.tar.gz: 935a6225e964eb46b6f26e57ccf3080fd231570f3710bf6e78e3f05f589a294f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d768219d315950da7cc798981c6d081e23f2ffab97f354149ebae1398a25cf3db304bdd81429f8e3f257cb0100cc1a28374a1459cef4dc551d317d9bb1cade0
|
7
|
+
data.tar.gz: 758a733387749553121d3117d9a86ae6109fc28fcbae12cce2852c9d291a30ad133c16060a5374c6c13aadc16af02996fba41a239998d32a194d0516fa75c71f
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# HTTP-2-Next
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/http-2-next.svg)](http://rubygems.org/gems/http-2-next)
|
4
|
-
[![Build status](https://gitlab.com/
|
5
|
-
[![coverage report](https://gitlab.com/
|
4
|
+
[![Build status](https://gitlab.com/os85/http-2-next/badges/master/pipeline.svg)](https://gitlab.com/os85/http-2-next/commits/master)
|
5
|
+
[![coverage report](https://gitlab.com/os85/http-2-next/badges/master/coverage.svg?job=coverage)](https://os85.gitlab.io/http-2-next/coverage/#_AllFiles)
|
6
6
|
|
7
7
|
**Attention!** This is a fork of the [http-2](https://github.com/igrigorik/http-2) gem.
|
8
8
|
|
@@ -265,7 +265,7 @@ conn.on(:stream) do |stream|
|
|
265
265
|
# split response between multiple DATA frames
|
266
266
|
stream.data(response_chunk, end_stream: false)
|
267
267
|
stream.data(last_chunk)
|
268
|
-
|
268
|
+
|
269
269
|
# now send the previously promised data
|
270
270
|
push_stream.data(push_data)
|
271
271
|
end
|
data/lib/http/2/next/emitter.rb
CHANGED
@@ -10,7 +10,7 @@ module HTTP2Next
|
|
10
10
|
# @param event [Symbol]
|
11
11
|
# @param block [Proc] callback function
|
12
12
|
def on(event, &block)
|
13
|
-
raise ArgumentError, "must provide callback" unless
|
13
|
+
raise ArgumentError, "must provide callback" unless block
|
14
14
|
|
15
15
|
listeners(event.to_sym).push block
|
16
16
|
end
|
data/lib/http/2/next/error.rb
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
module HTTP2Next
|
4
4
|
# Stream, connection, and compressor exceptions.
|
5
5
|
module Error
|
6
|
-
@types = {}
|
6
|
+
@types = {} # rubocop:disable ThreadSafety/MutableClassInstanceVariable
|
7
|
+
|
7
8
|
class << self
|
8
9
|
attr_reader :types
|
9
10
|
end
|
@@ -60,5 +61,7 @@ module HTTP2Next
|
|
60
61
|
class StreamLimitExceeded < Error; end
|
61
62
|
|
62
63
|
class FrameSizeError < Error; end
|
64
|
+
|
65
|
+
@types.freeze
|
63
66
|
end
|
64
67
|
end
|
data/lib/http/2/next/framer.rb
CHANGED
@@ -325,7 +325,7 @@ module HTTP2Next
|
|
325
325
|
# Padding: Padding octets that contain no application semantic value.
|
326
326
|
# Padding octets MUST be set to zero when sending and ignored when
|
327
327
|
# receiving.
|
328
|
-
bytes << "\0" * padlen
|
328
|
+
bytes << ("\0" * padlen)
|
329
329
|
end
|
330
330
|
|
331
331
|
frame[:length] = length
|
@@ -368,7 +368,7 @@ module HTTP2Next
|
|
368
368
|
end
|
369
369
|
|
370
370
|
case frame[:type]
|
371
|
-
when :data
|
371
|
+
when :data, :ping, :continuation
|
372
372
|
frame[:payload] = payload.read(frame[:length])
|
373
373
|
when :headers
|
374
374
|
if frame[:flags].include? :priority
|
@@ -414,8 +414,6 @@ module HTTP2Next
|
|
414
414
|
when :push_promise
|
415
415
|
frame[:promise_stream] = payload.read_uint32 & RBIT
|
416
416
|
frame[:payload] = payload.read(frame[:length])
|
417
|
-
when :ping
|
418
|
-
frame[:payload] = payload.read(frame[:length])
|
419
417
|
when :goaway
|
420
418
|
frame[:last_stream] = payload.read_uint32 & RBIT
|
421
419
|
frame[:error] = unpack_error payload.read_uint32
|
@@ -428,8 +426,6 @@ module HTTP2Next
|
|
428
426
|
end
|
429
427
|
|
430
428
|
frame[:increment] = payload.read_uint32 & RBIT
|
431
|
-
when :continuation
|
432
|
-
frame[:payload] = payload.read(frame[:length])
|
433
429
|
when :altsvc
|
434
430
|
frame[:max_age], frame[:port] = payload.read(6).unpack(UINT32 + UINT16)
|
435
431
|
|
@@ -30,8 +30,8 @@ module HTTP2Next
|
|
30
30
|
# @param n [Integer] number of available bits
|
31
31
|
# @return [Integer]
|
32
32
|
def integer(buf, n)
|
33
|
-
limit = 2**n - 1
|
34
|
-
i =
|
33
|
+
limit = (2**n) - 1
|
34
|
+
i = n.zero? ? 0 : (buf.shift_byte & limit)
|
35
35
|
|
36
36
|
m = 0
|
37
37
|
if i == limit
|
@@ -81,7 +81,7 @@ module HTTP2Next
|
|
81
81
|
|
82
82
|
STATIC_TABLE_BY_FIELD = STATIC_TABLE
|
83
83
|
.each_with_object({})
|
84
|
-
.
|
84
|
+
.with_index { |((field, value), hs), idx| (hs[field] ||= []) << [idx, value] }
|
85
85
|
.each { |pair| pair.each(&:freeze).freeze }.freeze
|
86
86
|
|
87
87
|
STATIC_TABLE_SIZE = STATIC_TABLE.size
|
@@ -25,7 +25,7 @@ module HTTP2Next
|
|
25
25
|
# @return [String] binary string
|
26
26
|
def encode(str)
|
27
27
|
bitstring = str.each_byte.map { |chr| ENCODE_TABLE[chr] }.join
|
28
|
-
bitstring << "1" * ((8 - bitstring.size) % 8)
|
28
|
+
bitstring << ("1" * ((8 - bitstring.size) % 8))
|
29
29
|
[bitstring].pack("B*")
|
30
30
|
end
|
31
31
|
|
@@ -40,7 +40,7 @@ module HTTP2Next
|
|
40
40
|
|
41
41
|
mask = (1 << BITS_AT_ONCE) - 1
|
42
42
|
buf.each_byte do |chr|
|
43
|
-
(8 / BITS_AT_ONCE - 1).downto(0) do |shift|
|
43
|
+
((8 / BITS_AT_ONCE) - 1).downto(0) do |shift|
|
44
44
|
branch = (chr >> (shift * BITS_AT_ONCE)) & mask
|
45
45
|
# MACHINE[state] = [final, [transitions]]
|
46
46
|
# [final] unfinished bits so far are prefix of the EOS code.
|
data/lib/http/2/next/stream.rb
CHANGED
@@ -129,10 +129,9 @@ module HTTP2Next
|
|
129
129
|
@_status_code ||= frame[:status]
|
130
130
|
@_content_length ||= frame[:content_length]
|
131
131
|
@_trailers ||= frame[:trailer]
|
132
|
-
if @_waiting_on_trailers
|
133
|
-
|
134
|
-
|
135
|
-
(!@_status_code || @_status_code >= 200)
|
132
|
+
if @_waiting_on_trailers ||
|
133
|
+
(@received_data &&
|
134
|
+
(!@_status_code || @_status_code >= 200))
|
136
135
|
|
137
136
|
# An endpoint that receives a HEADERS frame without the END_STREAM flag set after receiving a final
|
138
137
|
# (non-informational) status code MUST treat the corresponding request or response as malformed.
|
@@ -225,7 +224,7 @@ module HTTP2Next
|
|
225
224
|
end
|
226
225
|
|
227
226
|
def promise(headers, end_headers: true, &block)
|
228
|
-
raise ArgumentError, "must provide callback" unless
|
227
|
+
raise ArgumentError, "must provide callback" unless block
|
229
228
|
|
230
229
|
flags = end_headers ? [:end_headers] : []
|
231
230
|
emit(:promise, self, headers, flags, &block)
|
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.5.
|
4
|
+
version: 0.5.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:
|
13
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Pure-ruby HTTP 2.0 protocol implementation
|
16
16
|
email:
|
@@ -53,10 +53,15 @@ files:
|
|
53
53
|
- sig/next.rbs
|
54
54
|
- sig/server.rbs
|
55
55
|
- sig/stream.rbs
|
56
|
-
homepage: https://gitlab.com/
|
56
|
+
homepage: https://gitlab.com/os85/http-2-next
|
57
57
|
licenses:
|
58
58
|
- MIT
|
59
|
-
metadata:
|
59
|
+
metadata:
|
60
|
+
bug_tracker_uri: https://gitlab.com/os85/http-2-next/issues
|
61
|
+
changelog_uri: https://gitlab.com/os85/http-2-next/-/blob/master/CHANGELOG.md
|
62
|
+
source_code_uri: https://gitlab.com/os85/http-2-next
|
63
|
+
homepage_uri: https://gitlab.com/os85/http-2-next
|
64
|
+
rubygems_mfa_required: 'true'
|
60
65
|
post_install_message:
|
61
66
|
rdoc_options: []
|
62
67
|
require_paths:
|
@@ -72,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
77
|
- !ruby/object:Gem::Version
|
73
78
|
version: '0'
|
74
79
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
80
|
+
rubygems_version: 3.3.7
|
76
81
|
signing_key:
|
77
82
|
specification_version: 4
|
78
83
|
summary: Pure-ruby HTTP 2.0 protocol implementation
|