Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions fetch.bs
Original file line number Diff line number Diff line change
Expand Up @@ -288,16 +288,16 @@ for consistency.

<h4 id=terminology-headers>Headers</h4>

<p>A <dfn export id=concept-header-list>header list</dfn> consists of zero or more
<a for=/>headers</a>.
<p>A <dfn export id=concept-header-list>header list</dfn> is a <a for=/>list</a> of zero or more
<a for=/>headers</a>. It is initially the empty list.

<p class="note no-backref">A <a for=/>header list</a> is essentially a
specialized multimap. An ordered list of key-value pairs with potentially duplicate keys.

<p>A <a for=/>header list</a> (<var>list</var>)
<dfn export for="header list" lt="contains|does not contain">contains</dfn> a <a for=header>name</a>
(<var>name</var>) if <var>list</var> contains a <a for=/>header</a> whose <a for=header>name</a> is
a <a>byte-case-insensitive</a> match for <var>name</var>.
(<var>name</var>) if <var>list</var> <a for=list>contains</a> a <a for=/>header</a> whose
<a for=header>name</a> is a <a>byte-case-insensitive</a> match for <var>name</var>.

<p>To <dfn export for="header list" id=concept-header-list-append>append</dfn> a
<a for=header>name</a>/<a for=header>value</a> (<var>name</var>/<var>value</var>) pair to a
Expand All @@ -309,30 +309,29 @@ a <a>byte-case-insensitive</a> match for <var>name</var>.
to the first such <a for=/>header</a>'s <a for=header>name</a>.

<p class="note no-backref">This reuses the casing of the <a for=header>name</a> of the
<a for=/>header</a> already in the <a for=/>header list</a>, if any. If there are multiple matched
<a for=/>header</a> already in <var>list</var>, if any. If there are multiple matched
<a for=/>headers</a> their <a for=header>names</a> will all be identical.
<!-- XXX Firefox and Safari adjust known header names too. -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you mention this removal in the commit message? Is it no longer a problem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xhr/setrequestheader-case-insensitive.htm tests this. It's a problem in Safari still, but it's filed somewhere.


<li><p>Append a new <a for=/>header</a> whose <a for=header>name</a> is <var>name</var> and
<a for=header>value</a> is <var>value</var> to <var>list</var>.
<li><p><a for=list>Append</a> a new <a for=/>header</a> whose <a for=header>name</a> is
<var>name</var> and <a for=header>value</a> is <var>value</var> to <var>list</var>.
</ol>

<p>To <dfn export for="header list" id=concept-header-list-delete>delete</dfn> a
<a for=header>name</a> (<var>name</var>) from a <a for=/>header list</a> (<var>list</var>), remove
all <a for=/>headers</a> whose <a for=header>name</a> is a <a>byte-case-insensitive</a> match for
<var>name</var> from <var>list</var>.
<a for=header>name</a> (<var>name</var>) from a <a for=/>header list</a> (<var>list</var>),
<a for=list>remove</a> all <a for=/>headers</a> whose <a for=header>name</a> is a
<a>byte-case-insensitive</a> match for <var>name</var> from <var>list</var>.

<p>To <dfn export for="header list" id=concept-header-list-set>set</dfn> a
<a for=header>name</a>/<a for=header>value</a> (<var>name</var>/<var>value</var>) pair in a
<a for=/>header list</a> (<var>list</var>), run these steps:

<ol>
<li><p>If <var>list</var> <a for="header list">contains</a> <var>name</var>, then set the
<a for=header>value</a> of the first such <a for=/>header</a> to <var>value</var> and remove the
others.
<a for=header>value</a> of the first such <a for=/>header</a> to <var>value</var> and
<a for=list>remove</a> the others.

<li><p>Otherwise, append a new <a for=/>header</a> whose <a for=header>name</a> is <var>name</var>
and <a for=header>value</a> is <var>value</var> to <var>list</var>.
<li><p>Otherwise, <a for=list>append</a> a new <a for=/>header</a> whose <a for=header>name</a> is
<var>name</var> and <a for=header>value</a> is <var>value</var> to <var>list</var>.
</ol>

<p>To <dfn export for="header list" id=concept-header-list-combine>combine</dfn> a
Expand All @@ -344,8 +343,8 @@ all <a for=/>headers</a> whose <a for=header>name</a> is a <a>byte-case-insensit
<a for=header>value</a> of the first such <a for=/>header</a> to its <a for=header>value</a>,
followed by 0x2C 0x20, followed by <var>value</var>.

<li><p>Otherwise, append a new <a for=/>header</a> whose <a for=header>name</a> is <var>name</var>
and <a for=header>value</a> is <var>value</var> to <var>list</var>.
<li><p>Otherwise, <a for=list>append</a> a new <a for=/>header</a> whose <a for=header>name</a> is
<var>name</var> and <a for=header>value</a> is <var>value</var> to <var>list</var>.
</ol>

<p class="note no-backref"><a for="header list">Combine</a> is used by {{XMLHttpRequest}} and the
Expand All @@ -356,24 +355,22 @@ all <a for=/>headers</a> whose <a for=header>name</a> is a <a>byte-case-insensit
a <a for=/>header list</a> (<var>list</var>), run these steps:

<ol>
<li><p>Let <var>headers</var> be an empty list of
<a for=header>name</a>-<a for=header>value</a> pairs
with the key being the <a for=header>name</a> and value the
<a for=header>value</a>.
<li><p>Let <var>headers</var> be an empty <a for=/>list</a> of
<a for=header>name</a>-<a for=header>value</a> pairs with the key being the <a for=header>name</a>
and value the <a for=header>value</a>.

<li><p>Let <var>names</var> be all the <a lt=name for=header>names</a> of the
<a for=/>headers</a> in <var>list</var>, <a>byte-lowercased</a>, with duplicates removed, and
finally sorted lexicographically.

<li>
<p>For each <var>name</var> in <var>names</var>, run these substeps:
<p><a for=list>For each</a> <var>name</var> in <var>names</var>:

<ol>
<li><p>Let <var>value</var> be the
<a for=header>combined value</a> given <var>name</var> and
<li><p>Let <var>value</var> be the <a for=header>combined value</a> given <var>name</var> and
<var>list</var>.

<li><p>Append <var>name</var>-<var>value</var> to <var>headers</var>.
<li><p><a for=list>Append</a> <var>name</var>-<var>value</var> to <var>headers</var>.
</ol>

<li><p>Return <var>headers</var>.
Expand Down