You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/protocol/http/header/etag.rb
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ module Header
10
10
#
11
11
# The `etag` header provides a unique identifier for a specific version of a resource, typically used for cache validation or conditional requests. It can be either a strong or weak validator as defined in RFC 9110.
12
12
classETag < String
13
-
# Parses a raw header value from the wire.
13
+
# Parses a raw header value.
14
14
#
15
-
# @parameter value [String] the raw header value.
15
+
# @parameter value [String] a raw header value.
16
16
# @returns [ETag] a new instance.
17
17
defself.parse(value)
18
18
self.new(value)
@@ -26,9 +26,9 @@ def self.coerce(value)
26
26
self.new(value.to_s)
27
27
end
28
28
29
-
# Replaces the current value of the `etag` header with a raw wire-format string.
29
+
# Replaces the current value of the `etag` header.
30
30
#
31
-
# @parameter value [String] a raw wire-format value for the `etag` header.
31
+
# @parameter value [String] a raw header value for the `etag` header.
Copy file name to clipboardExpand all lines: lib/protocol/http/header/multiple.rb
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,11 @@ module Header
10
10
#
11
11
# This isn't a specific header but is used as a base for headers that store multiple values, such as cookies. The values are split and stored as an array internally, and serialized back to a newline-separated string when needed.
12
12
classMultiple < Array
13
-
# Parses a raw header value from the wire.
13
+
# Parses a raw header value.
14
14
#
15
-
# Multiple headers receive each value as a separate header entry on the wire, so this method takes a single string value and creates a new instance containing it.
15
+
# Multiple headers receive each value as a separate header entry, so this method takes a single string value and creates a new instance containing it.
16
16
#
17
-
# @parameter value [String] a single raw header value from the wire.
17
+
# @parameter value [String] a single raw header value.
18
18
# @returns [Multiple] a new instance containing the parsed value.
19
19
defself.parse(value)
20
20
self.new([value])
@@ -46,11 +46,11 @@ def initialize(value = nil)
46
46
end
47
47
end
48
48
49
-
# Converts the parsed header value into a raw wire-format string.
49
+
# Converts the parsed header value into a raw header value.
50
50
#
51
-
# Multiple headers are transmitted as separate header entries on the wire, so this serializes to a newline-separated string for storage.
51
+
# Multiple headers are transmitted as separate header entries, so this serializes to a newline-separated string for storage.
52
52
#
53
-
# @returns [String] a raw wire-format value (newline-separated string).
53
+
# @returns [String] a raw header value (newline-separated string).
Copy file name to clipboardExpand all lines: lib/protocol/http/header/priority.rb
+26-6Lines changed: 26 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -12,24 +12,44 @@ module Header
12
12
#
13
13
# The `priority` header allows clients to express their preference for how resources should be prioritized by the server. It supports directives like `u=` to specify the urgency level of a request, and `i` to indicate whether a response can be delivered incrementally. The urgency levels range from 0 (highest priority) to 7 (lowest priority), while the `i` directive is a boolean flag.
14
14
classPriority < Split
15
-
# Initializes the priority header with already-parsed and normalized values.
15
+
# Parses a raw header value.
16
16
#
17
-
# @parameter value [Array | Nil] an array of normalized (lowercase) directives, or `nil` for an empty header.
17
+
# @parameter value [String] a raw header value containing comma-separated directives.
18
+
# @returns [Priority] a new instance with normalized (lowercase) directives.
19
+
defself.parse(value)
20
+
self.new(value.downcase.split(COMMA))
21
+
end
22
+
23
+
# Coerces a value into a parsed header object.
24
+
#
25
+
# @parameter value [String | Array] the value to coerce.
26
+
# @returns [Priority] a parsed header object with normalized values.
27
+
defself.coerce(value)
28
+
casevalue
29
+
whenArray
30
+
self.new(value.map(&:downcase))
31
+
else
32
+
self.parse(value.to_s)
33
+
end
34
+
end
35
+
36
+
# Initializes the priority header with the given values.
37
+
#
38
+
# @parameter value [Array | String | Nil] an array of directives, a raw header value, or `nil` for an empty header.
18
39
definitialize(value=nil)
19
40
ifvalue.is_a?(Array)
20
-
super(value.map(&:downcase))
41
+
super(value)
21
42
elsifvalue.is_a?(String)
22
-
# Compatibility with the old constructor, prefer to use `parse` instead:
0 commit comments