Skip to content

Commit 5e7bae7

Browse files
committed
Add support for insertion.
See #29.
1 parent 1ec328c commit 5e7bae7

File tree

1 file changed

+25
-12
lines changed

1 file changed

+25
-12
lines changed

draft-xx-httpbis-range-patch-00.txt

+25-12
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@ Table of Contents
138138

139139
A patch with empty contents corresponds to deletion of existing
140140
content at the specified range. A patch with a zero-length range but
141-
non-empty contents corresponds to inserting content at a location. A
142-
patch with non-empty contents at a non-zero-length range corresponds
143-
to replacing existing content at the range with new content.
141+
non-empty contents corresponds to inserting content immediately
142+
before the location of the zero-length range. A patch with non-empty
143+
contents at a non-zero-length range corresponds to replacing existing
144+
content at the range with new content.
144145

145146
When server supports Range header with non-GET requests, server MUST
146147
NOT ignore the Range header when used with a non-GET request. When
@@ -265,14 +266,20 @@ Table of Contents
265266
token CAN be compromised of two sets of digits (according to the
266267
ABNF syntax for array indices as specified in Section 4 of
267268
[RFC6901]), delimited by a character "-". Each set of digits
268-
represent an unsigned base-10 integer value. The second integer
269-
value MUST be strictly larger than the first integer value,
270-
otherwise an error condition is raised. The new referenced value
271-
is a new array with a subset of elements starting at the zero-based
272-
index of the first integer value, and ending at the element before
273-
the zero-based index of the second integer value (the first index
274-
is inclusive, the second index is exclusive). The range cannot
275-
span non-existing array elements.
269+
represent an unsigned base-10 integer value. The first integer
270+
value MUST be smaller than the number of elements in the array,
271+
except when it is equal to the second integer value and is equal to
272+
the number of elements in the array. The second integer value MUST
273+
be smaller than or equal to the number of elements in the array.
274+
The second integer value MUST be larger than or equal to the first
275+
integer value. If any of these requirements are violated, an error
276+
condition is raised.
277+
278+
The new referenced value is a new array with a subset of elements
279+
starting at the zero-based index of the first integer value, and
280+
ending at the element before the zero-based index of the second
281+
integer value (the first index is inclusive, the second index is
282+
exclusive).
276283

277284
o If the currently referenced value is a JSON string, the scheme for
278285
JSON arrays is used to index into a string and makes the new
@@ -299,12 +306,18 @@ Table of Contents
299306
"/foo/0" "bar"
300307
"/foo/0-1" ["bar"]
301308
"/foo/1-3" ["baz", "bax"]
302-
"/foo/1-1" // error
309+
"/foo/1-1" []
310+
"/foo/3-3" []
311+
"/foo/4-4" // error
303312
"/foo/1-0" // error
304313
"/foo/1-4" // error
305314
"/foo/1-3/0" // error
306315
"/foo/0/1-3" "ar"
307316

317+
JSON ranges "/foo/1-1" and "/foo/3-3" are on its own of little
318+
utility, but serve as a zero-length range to identify a location
319+
immediately before which new content can be inserted with a patch.
320+
308321
4. IANA Considerations
309322

310323
4.1. Range Unit Registration

0 commit comments

Comments
 (0)