@@ -141,3 +141,73 @@ Below MUST be implemented **in addition** to "HTTP Response" of :cite[path-gatew
141141### ` Content-Disposition ` (response header)
142142
143143MUST be returned and set to ` attachment ` to ensure requested bytes are not rendered by a web browser.
144+
145+ ## HTTP Response Payload
146+
147+ ### Block Response
148+
149+ An opaque bytes matching the requested block CID
150+ ([ application/vnd.ipld.raw] ( https://www.iana.org/assignments/media-types/application/vnd.ipld.raw ) ).
151+
152+ The Body hash MUST match the Multihash from the requested CID.
153+
154+ ### CAR Response
155+
156+ A CAR stream
157+ ([ application/vnd.ipld.car] ( https://www.iana.org/assignments/media-types/application/vnd.ipld.car ) )
158+ for the requested content type, path and optional ` dag-scope ` and ` entity-bytes ` URL parameters.
159+
160+ ::: note
161+
162+ By default, block order in CAR response is not deterministic, blocks can
163+ be returned in different order, depending on implementation choices (traversal,
164+ speed at which blocks arrive from the network, etc). An opt-in ordered CAR
165+ responses MAY be introduced in a future, see [ IPIP-412] ( https://github.com/ipfs/specs/pull/412 ) .
166+
167+ :::
168+
169+ #### CAR version
170+
171+ Value returned in ` CarV1Header.version ` struct MUST match the ` version `
172+ parameter returned in ` Content-Type ` header
173+
174+ #### CAR roots
175+
176+ ::: issue
177+
178+ TODO: we need to specify expectations about what should be returned in
179+ [ ` CarV1Header.roots ` ] ( https://ipld.io/specs/transport/car/carv1/#header ) .
180+
181+ ##### Option A: always empty
182+
183+ If the response uses version 1 or 2 of the CAR spec, the
184+ [ ` CarV1Header.roots ` ] ( https://ipld.io/specs/transport/car/carv1/#header ) struct
185+ MUST be empty.
186+
187+ ##### Option B: only CID of the terminating element
188+
189+ If the response uses version 1 or 2 of the CAR spec, the
190+ [ ` CarV1Header.roots ` ] ( https://ipld.io/specs/transport/car/carv1/#header ) struct
191+ MUST contain CID of the terminating entity.
192+
193+ ##### Option C: only CIDs of fully returned DAGs
194+
195+ If the response uses version 1 or 2 of the CAR spec, the
196+ [ ` CarV1Header.roots ` ] ( https://ipld.io/specs/transport/car/carv1/#header ) struct
197+ MUST be either empty, or only contain CIDs of complete DAGs present in the response.
198+
199+ CIDs from partial DAGs, such as parent nodes on the path, or terminating
200+ element returned with ` dag-scope=block ` , or UnixFS directory returned with
201+ ` dag-scope=entity ` MUST never be returned in the ` CarV1Header.roots ` list, as
202+ they may cause overfetching on systems that perform recursive pinning of DAGs
203+ listed in ` CarV1Header.roots ` .
204+
205+ ##### Option D: CIDs for all logical path segments (same as X-Ipfs-Roots)
206+
207+ If the response uses version 1 or 2 of the CAR spec, the
208+ [ ` CarV1Header.roots ` ] ( https://ipld.io/specs/transport/car/carv1/#header ) struct
209+ MUST contain all the logical roots related to the requested content path.
210+
211+ The CIDs here MUST be the same as ones in ` X-Ipfs-Roots ` header.
212+
213+ :::
0 commit comments