iodine 0.8.2 → 0.8.3

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.
@@ -1603,6 +1603,60 @@ module Iodine
1603
1603
  # @return [String, nil]
1604
1604
  attr_accessor :query
1605
1605
 
1606
+ # (HTTP Only) Returns a parsed parameter Hash for the request, following the NeoRack `params` extension (version 0.0.1).
1607
+ #
1608
+ # The returned Hash is memoized (repeated calls return the same object) and merges:
1609
+ #
1610
+ # 1. the URL query string; and
1611
+ # 2. the request body, when its content type is `application/x-www-form-urlencoded`,
1612
+ # `multipart/form-data`, `application/json`, `text/json`, `application/x-json`,
1613
+ # or an `application/*+json` media type (matching is case-insensitive and ignores parameters).
1614
+ #
1615
+ # Nested paths such as `user[name]` build nested Hashes and `tags[]` builds Arrays.
1616
+ # Invalid path segments are treated as literal String keys. Repeated scalar names
1617
+ # become Arrays (`?a=1&a=2` => `{"a" => ["1", "2"]}`). When a scalar and a nested
1618
+ # path conflict, the nested path wins; two containers of different types are merged
1619
+ # into an Array preserving both.
1620
+ #
1621
+ # File uploads (multipart) are represented by {Iodine::Base::Upload} objects: readable
1622
+ # binary streams (`read` / `rewind` / `size` / `save` / `close` / `closed?`) with
1623
+ # `filename` / `type` / `name` / `headers` metadata readers and Rack-style `[]` access
1624
+ # (`upload[:tempfile]` returns the upload itself). Uploads count as scalar values during
1625
+ # conflict resolution.
1626
+ #
1627
+ # Bodies with other or missing content types are not parsed. Malformed input is not an
1628
+ # error: the request proceeds with whatever partial structure could be retained.
1629
+ #
1630
+ # Exceeding the parser's resource limits (by default 4,096 fields or 128 levels of
1631
+ # nesting) raises a RangeError; an unhandled exception in a handler
1632
+ # results in a 500 response, per the core NeoRack specification.
1633
+ #
1634
+ # The body is parsed without consuming it: {#read} and `rack.input` remain unaffected.
1635
+ #
1636
+ # @return [Hash] the merged parameter Hash (memoized).
1637
+ # @raise [RangeError] when a resource limit is exceeded.
1638
+ def params; end
1639
+
1640
+ # (HTTP Only) Parses only the URL query string into the memoized parameter Hash and returns it.
1641
+ #
1642
+ # Later body parsing ({#body2params} / {#params}) will merge into the same Hash using the
1643
+ # extension's conflict-resolution rules, so query parameters take precedence over conflicting
1644
+ # body parameters (body values are appended to Arrays on scalar conflicts).
1645
+ #
1646
+ # @return [Hash] the memoized parameter Hash, containing the query parameters.
1647
+ # @raise [RangeError] when a resource limit is exceeded.
1648
+ def query2params; end
1649
+
1650
+ # (HTTP Only) Parses only the request body (when its content type is a supported parameters
1651
+ # or JSON media type) into the memoized parameter Hash and returns it.
1652
+ #
1653
+ # Query parameters parsed later or earlier merge into the same Hash; when the query is parsed
1654
+ # first (see {#query2params}), its values take precedence over conflicting body parameters.
1655
+ #
1656
+ # @return [Hash] the memoized parameter Hash, containing the body parameters.
1657
+ # @raise [RangeError] when a resource limit is exceeded.
1658
+ def body2params; end
1659
+
1606
1660
  # For HTTP connections, the `version` String value stated by the HTTP client.
1607
1661
  # @return [String]
1608
1662
  attr_accessor :version
@@ -2259,6 +2313,73 @@ module Iodine
2259
2313
 
2260
2314
  # Used internally by Iodine.
2261
2315
  class Base
2316
+ # A multipart file upload: metadata plus a readable binary stream.
2317
+ #
2318
+ # Implements the NeoRack `params` extension Upload interface (see
2319
+ # {Iodine::Connection#params}). This is an internal class and its details
2320
+ # may change; applications SHOULD NOT rely on the class itself, only on
2321
+ # the interface.
2322
+ #
2323
+ # The data may be stored in memory or spilled to a temporary file. The
2324
+ # upload is closed automatically (removing any temporary storage) when the
2325
+ # request ends or when it is garbage collected, after which reading
2326
+ # raises an IOError.
2327
+ class Upload
2328
+ # @return [String, nil] the client-provided basename (path components stripped).
2329
+ def filename; end
2330
+
2331
+ # @return [String, nil] the declared media type of the uploaded part.
2332
+ def type; end
2333
+
2334
+ # @return [String, nil] the form field name.
2335
+ def name; end
2336
+
2337
+ # @return [String, nil] the raw part headers (excluding the separator blank line).
2338
+ def headers; end
2339
+
2340
+ # Behaves like IO#read on a binary-mode IO.
2341
+ #
2342
+ # @param length [Integer, nil] nil reads all remaining bytes ("" at EOF);
2343
+ # 0 returns ""; a positive Integer reads up to that many bytes (nil at EOF).
2344
+ # @param out_string [String, nil] if supplied, receives and is the result
2345
+ # (left unchanged at EOF).
2346
+ # @return [String, nil] an ASCII-8BIT String, or nil at EOF when length > 0.
2347
+ # @raise [IOError] if the upload was closed.
2348
+ def read(length = nil, out_string = nil); end
2349
+
2350
+ # Moves to byte zero.
2351
+ # @return [Integer] 0
2352
+ # @raise [IOError] if the upload was closed.
2353
+ def rewind; end
2354
+
2355
+ # @return [Integer] the total byte count (never changes the read position).
2356
+ def size; end
2357
+
2358
+ # Atomically saves all the data to `path` (created or replaced; the read
2359
+ # position is unchanged). For uploads of 256KiB or more the disk I/O runs
2360
+ # outside the GVL.
2361
+ # @param path [String] the destination path.
2362
+ # @return [Integer] the number of bytes written.
2363
+ # @raise [IOError] if the upload was closed.
2364
+ # @raise [SystemCallError] if the save failed.
2365
+ def save(path); end
2366
+
2367
+ # Releases the stream and any temporary storage. Idempotent.
2368
+ # @return [nil]
2369
+ def close; end
2370
+
2371
+ # @return [Boolean] true after close; false while readable.
2372
+ def closed?; end
2373
+
2374
+ # Rack compatibility access: `upload[:tempfile]` returns the upload
2375
+ # itself; `:filename`, `:type`, `:name` and `:head` return the
2376
+ # corresponding metadata (`:head` is the raw part headers).
2377
+ def [](key); end
2378
+
2379
+ # Rack compatibility access; changes only the compatibility view.
2380
+ def []=(key, value); end
2381
+ end
2382
+
2262
2383
  # Prints the number of object withheld from the GC (for debugging).
2263
2384
  def self.print_debug; end
2264
2385
 
@@ -2,13 +2,14 @@
2
2
 
3
3
  module Iodine
4
4
  # The Iodine gem version number
5
- VERSION = "0.8.2"
5
+ VERSION = "0.8.3"
6
6
  # NeoRack supported extensions.
7
7
  def self.extensions
8
8
  return (@extensions ||= { iodine: (VERSION.split(?.).map() {|i| i.to_i.to_s == i ? i.to_i : i }),
9
9
  neo_rack: "0.0.4".split(?.).map(&:to_i),
10
10
  cookies: "0.0.2".split(?.).map(&:to_i),
11
11
  from: "0.0.2".split(?.).map(&:to_i),
12
+ params: "0.0.1".split(?.).map(&:to_i),
12
13
  pubsub: "0.0.2".split(?.).map(&:to_i),
13
14
  rack: "1.3.0".split(?.).map(&:to_i),
14
15
  rest: "0.0.2".split(?.).map(&:to_i),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
@@ -109,6 +109,7 @@ files:
109
109
  - ext/iodine/iodine_log.h
110
110
  - ext/iodine/iodine_minimap.h
111
111
  - ext/iodine/iodine_mustache.h
112
+ - ext/iodine/iodine_params.h
112
113
  - ext/iodine/iodine_pubsub_eng.h
113
114
  - ext/iodine/iodine_pubsub_history.h
114
115
  - ext/iodine/iodine_pubsub_msg.h
@@ -133,7 +134,7 @@ metadata:
133
134
  homepage_uri: https://github.com/boazsegev/iodine
134
135
  source_code_uri: https://github.com/boazsegev/iodine
135
136
  changelog_uri: https://github.com/boazsegev/iodine/blob/master/CHANGELOG.md
136
- post_install_message: Thank you for installing Iodine 0.8.2.
137
+ post_install_message: Thank you for installing Iodine 0.8.3.
137
138
  rdoc_options: []
138
139
  require_paths:
139
140
  - lib