@@ -760,6 +760,11 @@ syntactically invalid when used with an operation that sets headers in a
760
760
<p >This error indicates that a forbidden `field-key` was used when trying
761
761
to set a header in a ` fields ` .
762
762
</li >
763
+ <li >
764
+ <p ><a name =" header_error.immutable " ><code >immutable</code ></a ></p >
765
+ <p >This error indicates that the operation on the `fields` was not
766
+ permitted because the fields are immutable.
767
+ </li >
763
768
</ul >
764
769
<h4 ><a name =" field_key " ><code >type field-key</code ></a ></h4 >
765
770
<p ><code >string</code ></p >
@@ -810,12 +815,14 @@ are http-related errors.</p>
810
815
</ul >
811
816
<h4 ><a name =" constructor_fields " ><code >[constructor]fields: func</code ></a ></h4 >
812
817
<p >Construct an empty HTTP Fields.</p >
818
+ <p >The resulting <a href =" #fields " ><code >fields</code ></a > is mutable.</p >
813
819
<h5 >Return values</h5 >
814
820
<ul >
815
821
<li ><a name =" constructor_fields.0 " ></a > own< ; <a href =" #fields " ><a href =" #fields " ><code >fields</code ></a ></a >> ; </li >
816
822
</ul >
817
823
<h4 ><a name =" static_fields.from_list " ><code >[static]fields.from-list: func</code ></a ></h4 >
818
824
<p >Construct an HTTP Fields.</p >
825
+ <p >The resulting <a href =" #fields " ><code >fields</code ></a > is mutable.</p >
819
826
<p >The list represents each key-value pair in the Fields. Keys
820
827
which have multiple values are represented by multiple entries in this
821
828
list with the same key.</p >
@@ -847,6 +854,7 @@ syntactically invalid, or if a header was forbidden.</p>
847
854
<h4 ><a name =" method_fields.set " ><code >[method]fields.set: func</code ></a ></h4 >
848
855
<p >Set all of the values for a key. Clears any existing values for that
849
856
key, if they have been set.</p >
857
+ <p >Fails with <code >header-error.immutable</code > if the <a href =" #fields " ><code >fields</code ></a > are immutable.</p >
850
858
<h5 >Params</h5 >
851
859
<ul >
852
860
<li ><a name =" method_fields.set.self " ><code >self</code ></a >: borrow< ; <a href =" #fields " ><a href =" #fields " ><code >fields</code ></a ></a >> ; </li >
@@ -860,6 +868,7 @@ key, if they have been set.</p>
860
868
<h4 ><a name =" method_fields.delete " ><code >[method]fields.delete: func</code ></a ></h4 >
861
869
<p >Delete all values for a key. Does nothing if no values for the key
862
870
exist.</p >
871
+ <p >Fails with <code >header-error.immutable</code > if the <a href =" #fields " ><code >fields</code ></a > are immutable.</p >
863
872
<h5 >Params</h5 >
864
873
<ul >
865
874
<li ><a name =" method_fields.delete.self " ><code >self</code ></a >: borrow< ; <a href =" #fields " ><a href =" #fields " ><code >fields</code ></a ></a >> ; </li >
@@ -872,6 +881,7 @@ exist.</p>
872
881
<h4 ><a name =" method_fields.append " ><code >[method]fields.append: func</code ></a ></h4 >
873
882
<p >Append a value for a key. Does not change or delete any existing
874
883
values for that key.</p >
884
+ <p >Fails with <code >header-error.immutable</code > if the <a href =" #fields " ><code >fields</code ></a > are immutable.</p >
875
885
<h5 >Params</h5 >
876
886
<ul >
877
887
<li ><a name =" method_fields.append.self " ><code >self</code ></a >: borrow< ; <a href =" #fields " ><a href =" #fields " ><code >fields</code ></a ></a >> ; </li >
@@ -898,7 +908,8 @@ list with the same key.</p>
898
908
</ul >
899
909
<h4 ><a name =" method_fields.clone " ><code >[method]fields.clone: func</code ></a ></h4 >
900
910
<p >Make a deep copy of the Fields. Equivelant in behavior to calling the
901
- <a href =" #fields " ><code >fields</code ></a > constructor on the return value of <code >entries</code ></p >
911
+ <a href =" #fields " ><code >fields</code ></a > constructor on the return value of <code >entries</code >. The resulting
912
+ <a href =" #fields " ><code >fields</code ></a > is mutable.</p >
902
913
<h5 >Params</h5 >
903
914
<ul >
904
915
<li ><a name =" method_fields.clone.self " ><code >self</code ></a >: borrow< ; <a href =" #fields " ><a href =" #fields " ><code >fields</code ></a ></a >> ; </li >
@@ -948,7 +959,9 @@ list with the same key.</p>
948
959
<li ><a name =" method_incoming_request.authority.0 " ></a > option< ; <code >string</code >> ; </li >
949
960
</ul >
950
961
<h4 ><a name =" method_incoming_request.headers " ><code >[method]incoming-request.headers: func</code ></a ></h4 >
951
- <p >Returns the <a href =" #headers " ><code >headers</code ></a > from the request.</p >
962
+ <p >Get the <a href =" #headers " ><code >headers</code ></a > associated with the request.</p >
963
+ <p >The returned <a href =" #headers " ><code >headers</code ></a > resource is immutable: <code >set</code >, <code >append</code >, and
964
+ <code >delete</code > operations will fail with <code >header-error.immutable</code >.</p >
952
965
<p >The <a href =" #headers " ><code >headers</code ></a > returned are a child resource: it must be dropped before
953
966
the parent <a href =" #incoming_request " ><code >incoming-request</code ></a > is dropped. Dropping this
954
967
<a href =" #incoming_request " ><code >incoming-request</code ></a > before all children are dropped will trap.</p >
@@ -1102,6 +1115,8 @@ not a syntactically valid uri authority.</p>
1102
1115
</ul >
1103
1116
<h4 ><a name =" method_outgoing_request.headers " ><code >[method]outgoing-request.headers: func</code ></a ></h4 >
1104
1117
<p >Get the headers associated with the Request.</p >
1118
+ <p >The returned <a href =" #headers " ><code >headers</code ></a > resource is immutable: <code >set</code >, <code >append</code >, and
1119
+ <code >delete</code > operations will fail with <code >header-error.immutable</code >.</p >
1105
1120
<p >This headers resource is a child: it must be dropped before the parent
1106
1121
<a href =" #outgoing_request " ><code >outgoing-request</code ></a > is dropped, or its ownership is transfered to
1107
1122
another component by e.g. <code >outgoing-handler.handle</code >.</p >
@@ -1212,6 +1227,10 @@ implementation determine how to respond with an HTTP error response.</p>
1212
1227
</ul >
1213
1228
<h4 ><a name =" method_incoming_response.headers " ><code >[method]incoming-response.headers: func</code ></a ></h4 >
1214
1229
<p >Returns the headers from the incoming response.</p >
1230
+ <p >The returned <a href =" #headers " ><code >headers</code ></a > resource is immutable: <code >set</code >, <code >append</code >, and
1231
+ <code >delete</code > operations will fail with <code >header-error.immutable</code >.</p >
1232
+ <p >This headers resource is a child: it must be dropped before the parent
1233
+ <a href =" #incoming_response " ><code >incoming-response</code ></a > is dropped.</p >
1215
1234
<h5 >Params</h5 >
1216
1235
<ul >
1217
1236
<li ><a name =" method_incoming_response.headers.self " ><code >self</code ></a >: borrow< ; <a href =" #incoming_response " ><a href =" #incoming_response " ><code >incoming-response</code ></a ></a >> ; </li >
@@ -1284,6 +1303,10 @@ once the future is ready.</p>
1284
1303
as well as any trailers, were received successfully, or that an error
1285
1304
occured receiving them. The optional <a href =" #trailers " ><code >trailers</code ></a > indicates whether or not
1286
1305
trailers were present in the body.</p >
1306
+ <p >When some <a href =" #trailers " ><code >trailers</code ></a > are returned by this method, the <a href =" #trailers " ><code >trailers</code ></a >
1307
+ resource is immutable, and a child. Use of the <code >set</code >, <code >append</code >, or
1308
+ <code >delete</code > methods will return an error, and the resource must be
1309
+ dropped before the parent <a href =" #future_trailers " ><code >future-trailers</code ></a > is dropped.</p >
1287
1310
<h5 >Params</h5 >
1288
1311
<ul >
1289
1312
<li ><a name =" method_future_trailers.get.self " ><code >self</code ></a >: borrow< ; <a href =" #future_trailers " ><a href =" #future_trailers " ><code >future-trailers</code ></a ></a >> ; </li >
@@ -1331,6 +1354,8 @@ given is not a valid http status code.</p>
1331
1354
</ul >
1332
1355
<h4 ><a name =" method_outgoing_response.headers " ><code >[method]outgoing-response.headers: func</code ></a ></h4 >
1333
1356
<p >Get the headers associated with the Request.</p >
1357
+ <p >The returned <a href =" #headers " ><code >headers</code ></a > resource is immutable: <code >set</code >, <code >append</code >, and
1358
+ <code >delete</code > operations will fail with <code >header-error.immutable</code >.</p >
1334
1359
<p >This headers resource is a child: it must be dropped before the parent
1335
1360
<a href =" #outgoing_request " ><code >outgoing-request</code ></a > is dropped, or its ownership is transfered to
1336
1361
another component by e.g. <code >outgoing-handler.handle</code >.</p >
0 commit comments