concept HTTP, TLS & web servers
HTTP range requests and If-Range resumable transfers
If-Range asks for the rest of a download only if the version still matches. Learn why a full 200 must stay separate and what to check before joining a 206 to saved bytes.
What it means
If-Range lets a client ask for the rest of a download on one condition: the requested bytes must belong to the same version the client started downloading. If the validator matches, the server can honor Range and return 206 Partial Content. If the validator does not match, the server ignores Range. For a GET that would otherwise return 200 OK, that means a full response starting at byte 0, not a continuation to append.
Try it
Simulation: suppose you have the first 400 bytes of a 1,000-byte representation. Those saved bytes occupy positions 0 through 399, so the next byte you want is at offset 400. The simulation uses synthetic values; it does not download anything or inspect a file.
HTTP range requests and If-Range resumable transfers
Explain validator-based safe partial resume and 206/200 responses
Range honored; response contains selected suffix. Append only after independently validating representation and Content-Range.
Response
- Status206
- First byte400
- Last byte999
- Append allowed by premiseYes
The fixture models one open-ended range. A 416 error-body length is not modeled. A partial response is not by itself permission to append to existing local bytes; the validator must establish the stipulated representation relation.
Evaluated inputs
- Required scenario evidence
- provided
- If-Range condition
- strong-match
- Server honors range
- yes
- Requested suffix starts at
- 400 bytes
- Current representation length
- 1000 bytes
Single open-ended byte range on otherwise-200 GET, nonempty representation. Date form allowed only under stipulated absence of entity-tag, strong date validator and exact match; no date parsing or actual HTTP. append=true means conditional eligibility in this toy case, not verified client file or authorization to append. 416 bytes is representation payload, not error-body length.
About this model
The controls set only a local, bounded scenario. The computed branch is not a verdict about a live system. Inputs listed as not evaluated did not participate in this branch after validation.
Reset restores the original inputs. It does not change the open or closed state of help or FAQ answers.
- Start with If-Range condition set to
strong-matchand Server honors range set toyes. The returned interval is 400–999: a206carrying 600 bytes. The matching validator makes this a candidate for resuming, not a verified append. - Change only If-Range condition to
strong-mismatch. The requested start is still 400, but it no longer determines the result. The response is200, covering bytes 0–999. Appending those 1,000 bytes after your saved 400 would put the start of the full response where byte 400 should be. - Choose
noneinstead. The result goes back to206, with the same 600 bytes by position as in the first case. This time there was no validator comparison: the interval fits, but the response does not establish that the two pieces belong together.
Reset restores the 1,000-byte length, offset 400, matching strong tag, honored range, and provided evidence.
Reading the byte interval
Range: bytes=400- means “from byte 400 through the end,” not “the last 400 bytes.” In the matching example, the single-part response interval would be described by Content-Range: bytes 400-999/1000. The first two numbers are inclusive positions, so the part contains 999 − 400 + 1 = 600 bytes. The number after the slash is the length of the whole representation, not the length of the part.
The last available position matters. With a matching validator and an honored range, starting at 999 selects one byte. Starting at 1,000 selects none: the model returns 416 Range Not Satisfiable. Its count of zero means zero bytes of the requested representation, not necessarily an empty error response. If the validator mismatches, the model never uses the offset to select bytes, so even offset 1,000 gives a full 200 instead.
The controls describe one open-ended interval in whole bytes: length 1–100,000 and start offset 0–100,000. They do not parse a header. The example is written without a space after =; the Range grammar as corrected by RFC 9110 erratum 7306 permits optional whitespace there.
An offset of exactly 1,000 in the 1,000-byte representation cannot select an existing byte. With a matching validator and a requested range, the fixture returns 416 and does not append. With a mismatching validator, the same offset is not used to form a partial interval; the fixture returns a separate full response. Check status and the actual interval before treating any bytes as a continuation.
In practice
Before joining two pieces, check both which representation the response describes and where its bytes belong. For the saved prefix in this example, you need evidence tying bytes 0–399 to the current representation. Then check that the single-part 206 has a valid Content-Range starting at 400 and that the returned bytes fit the stated interval. The local file size tells you a possible next offset; it does not identify the version of the file.
A strong entity-tag can supply the If-Range condition; a weak tag cannot. The date alternative is narrower: the client must have no entity-tag for that representation, and the date must qualify as a strong validator and match Last-Modified exactly. An unknown validator relationship is not a mismatch or a match. If you cannot establish it, do not treat the pieces as safe to join.
The same distinction matters for a cache collecting ranges from separate responses. Even adjoining intervals can come from different versions. A cache may combine them only if they share a strong validator and the applicable client requirements for combining responses are met. The simulation does not model a cache.
Read the response you received, not just the range you requested. A full 200 here belongs on its own, whether the validator mismatched or the server simply did not honor ranges. Keep the saved bytes separate unless you can establish both a matching representation and a correctly placed partial response.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
Can a weak ETag be used in If-Range?
No. The entity-tag form requires a strong validator. The date form is allowed only if no entity-tag is available and the date is a strong validator; the comparison is exact, not a before/after test.
What does 206 mean?
206 describes a partial response. Before appending, establish the representation relation and that the actual Content-Range starts where saved bytes end. A response status alone does not establish either fact.
What if response is 200?
Handle it as a new full representation under the modeled otherwise-200 GET. Do not append it to the old bytes. A 206 response also needs validation of the returned byte interval and representation identity.
Does every server honor Range?
No. Range support is optional for the applicable GET response. A client must inspect the actual status and Content-Range before treating a response as partial content.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- RFC 9110: HTTP Semantics
§13.1.5; §§14.1–14.4; §§15.3.7, 15.5.17; verified erratum 7306. Range is optional for an applicable GET response. If-Range requires a strong entity-tag or, if none is available, a strong date exactly matching Last-Modified. A false condition ignores Range; 206 represents a selected part with Content-Range. Verified erratum 7306 permits optional whitespace after the equals sign in the Range grammar; this lab does not parse wire syntax.
Checked .
- RFC 9111: HTTP Caching
§3.4. A cache can combine separately received ranges only when they share a strong validator and the applicable client requirements are satisfied. Similar byte offsets alone do not establish a matching representation.
Checked .