-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# frozen_string_literal: true | ||
|
||
# Released under the MIT License. | ||
# Copyright, 2019-2024, by Samuel Williams. | ||
|
||
require_relative "frame" | ||
require_relative "padded" | ||
require_relative "continuation_frame" | ||
|
||
module Protocol | ||
module HTTP2 | ||
# The PRIORITY_UPDATE frame is used by clients to signal the initial priority of a response, or to reprioritize a response or push stream. It carries the stream ID of the response and the priority in ASCII text, using the same representation as the Priority header field value. | ||
# | ||
# +-+-------------+-----------------------------------------------+ | ||
# |R| Prioritized Stream ID (31) | | ||
# +-+-----------------------------+-------------------------------+ | ||
# | Priority Field Value (*) ... | ||
# +---------------------------------------------------------------+ | ||
# | ||
class PriorityUpdateFrame < Frame | ||
TYPE = 0x10 | ||
FORMAT = "N".freeze | ||
|
||
def unpack | ||
data = super | ||
|
||
prioritized_stream_id = data.unpack(FORMAT) | ||
|
||
return prioritized_stream_id, data.byteslice(4, data.bytesize - 4) | ||
end | ||
|
||
def pack(prioritized_stream_id, data, **options) | ||
super([prioritized_stream_id].pack(FORMAT) + data, **options) | ||
end | ||
|
||
def apply(connection) | ||
connection.receive_priority_update(self) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters