protocol-multipart 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32d7a5d9ab53cbe80b179ea8ff2ac318415484eea858c4fc8f170c2bdcdb998a
4
- data.tar.gz: 8540f4f11737134c960c1bcdd6303a2418c17ca6c754864e9b83204bc93410fb
3
+ metadata.gz: fa90f615454830d99794083234b6004921aba4eaa2846c6977fa4e871fbba1f8
4
+ data.tar.gz: 1aac98c2b5492345559aa76abd036ae30055e6a614e42a04936e0852649ad519
5
5
  SHA512:
6
- metadata.gz: ce50fbd0c0bb2afc3396eba792684b2db2cfd839808bede5b0e38196966481d5924a1548dabbb6f42621b7afe0039ba8342e27c22ee815de142cc1e266ac7ee1
7
- data.tar.gz: 534c8bbc606b71e2d532d861a7d1633c53e28188f7542c1d5aa5000b758715a2eecad9ab1ed047a0f69d6e9def50ba019fe0f0e3965cf979e3c99aa4b1d5affe
6
+ metadata.gz: 0234a8d2cd90bdb27d77136d7decdb2f841090590dec28ca4b8e4d43eb729bd7f79dfa386bcf93a83ee401450c6add28743aa95ed2fa8261bcfc50cd9d3b7fbb
7
+ data.tar.gz: 5a04aaec79f48cc4c9e3dcf0ead6517b10c1aa74f084d5f5ec3c5d31e1b9b2856400ac305091bda7ec87596eccc6320b0eee0f69322eb17fcb7d9c8ae3e51922
checksums.yaml.gz.sig CHANGED
Binary file
@@ -3,6 +3,8 @@
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2026, by Samuel Williams.
5
5
 
6
+ require_relative "error"
7
+
6
8
  module Protocol
7
9
  module Multipart
8
10
  # Tracks consumed bytes against an optional maximum.
@@ -30,7 +32,7 @@ module Protocol
30
32
  @size += size
31
33
 
32
34
  if @maximum and @size > @maximum
33
- raise RangeError, "Multipart #{@name} exceeded limit of #{@maximum}!"
35
+ raise LimitError, "Multipart #{@name} exceeded limit of #{@maximum}!"
34
36
  end
35
37
 
36
38
  return @size
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2026, by Samuel Williams.
5
+
6
+ module Protocol
7
+ module Multipart
8
+ # Raised when multipart processing exceeds a configured limit.
9
+ class LimitError < StandardError
10
+ end
11
+ end
12
+ end
@@ -12,7 +12,7 @@ module Protocol
12
12
  class FormData
13
13
  # A configurable parser for `multipart/form-data` bodies.
14
14
  class Parser
15
- CONTENT_TYPE = "multipart/form-data"
15
+ MEDIA_TYPE = "multipart/form-data"
16
16
 
17
17
  # Initialize the form data parser.
18
18
  # @parameter field_size_limit [Integer | Nil] The buffered field size limit.
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2025, by Samuel Williams.
5
5
 
6
6
  require "io/stream"
7
+ require_relative "error"
7
8
  require_relative "headers"
8
9
 
9
10
  module Protocol
@@ -245,7 +246,7 @@ module Protocol
245
246
 
246
247
  def check_limit(name, value, limit)
247
248
  if limit and value > limit
248
- raise RangeError, "Multipart #{name} exceeded limit of #{limit}!"
249
+ raise LimitError, "Multipart #{name} exceeded limit of #{limit}!"
249
250
  end
250
251
  end
251
252
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Multipart
8
- VERSION = "0.4.0"
8
+ VERSION = "0.6.0"
9
9
  end
10
10
  end
@@ -4,6 +4,7 @@
4
4
  # Copyright, 2025, by Samuel Williams.
5
5
 
6
6
  require_relative "multipart/version"
7
+ require_relative "multipart/error"
7
8
  require_relative "multipart/byte_limit"
8
9
  require_relative "multipart/headers"
9
10
  require_relative "multipart/parser"
data/readme.md CHANGED
@@ -6,6 +6,14 @@
6
6
 
7
7
  Please see the [project releases](https://socketry.github.io/protocol-multipart/releases/index) for all releases.
8
8
 
9
+ ### v0.6.0
10
+
11
+ - Rename `Protocol::Multipart::FormData::Parser::CONTENT_TYPE` to `MEDIA_TYPE`.
12
+
13
+ ### v0.5.0
14
+
15
+ - Add `Protocol::Multipart::LimitError` for configured processing limits.
16
+
9
17
  ### v0.4.0
10
18
 
11
19
  - Use consistent limit naming for multipart parser constraints.
data/releases.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Releases
2
2
 
3
+ ## v0.6.0
4
+
5
+ - Rename `Protocol::Multipart::FormData::Parser::CONTENT_TYPE` to `MEDIA_TYPE`.
6
+
7
+ ## v0.5.0
8
+
9
+ - Add `Protocol::Multipart::LimitError` for configured processing limits.
10
+
3
11
  ## v0.4.0
4
12
 
5
13
  - Use consistent limit naming for multipart parser constraints.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-multipart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.5'
75
+ version: '0.9'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.5'
82
+ version: '0.9'
83
83
  executables: []
84
84
  extensions: []
85
85
  extra_rdoc_files: []
@@ -87,6 +87,7 @@ files:
87
87
  - lib/protocol/multipart.rb
88
88
  - lib/protocol/multipart/boundary.rb
89
89
  - lib/protocol/multipart/byte_limit.rb
90
+ - lib/protocol/multipart/error.rb
90
91
  - lib/protocol/multipart/escape.rb
91
92
  - lib/protocol/multipart/form_data.rb
92
93
  - lib/protocol/multipart/form_data/parser.rb
metadata.gz.sig CHANGED
Binary file