Skip to content

Commit

Permalink
[] (0) add unknown type sniffing. editorial tweaks to image section a…
Browse files Browse the repository at this point in the history
…nd fix for markup errors

git-svn-id: http://svn.whatwg.org/webapps@521 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jan 30, 2007
1 parent 4eeff42 commit bf67dd2
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 73 deletions.
175 changes: 134 additions & 41 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<h1 id=web-applications>Web Applications 1.0</h1>

<h2 class="no-num no-toc" id=working>Working Draft &mdash; 29 January 2007</h2>
<h2 class="no-num no-toc" id=working>Working Draft &mdash; 30 January 2007</h2>

<p>You can take part in this work. <a
href="http://www.whatwg.org/mailing-list">Join the working group's
Expand Down Expand Up @@ -831,9 +831,8 @@
<li><a href="#content-type0"><span class=secno>4.1.1.1. </span><dfn
id=content-type4>Content-Type sniffing: text or binary</dfn></a>

<li class=big-issue><a href="#content-type1"><span
class=secno>4.1.1.2. </span><dfn id=content-type5>Content-Type
sniffing: unknown type</dfn></a>
<li><a href="#content-type1"><span class=secno>4.1.1.2. </span><dfn
id=content-type5>Content-Type sniffing: unknown type</dfn></a>

<li><a href="#content-type2"><span class=secno>4.1.1.3. </span><dfn
id=content-type6>Content-Type sniffing: image</dfn></a>
Expand Down Expand Up @@ -18576,8 +18575,8 @@ XXX selection ranges -->
available.

<li>
<p>Let <var title="">n</var> be the biggest of either 512 or the number
of bytes already available.
<p>Let <var title="">n</var> be the bigger of either 512 or the number of
bytes already available.

<li>
<p>If <var title="">n</var> is 4 or more, and the first bytes of the file
Expand Down Expand Up @@ -18645,57 +18644,151 @@ XXX selection ranges -->
<p>Otherwise, the sniffed type of the resource is "text/plain".
</ol>

<h5 class=big-issue id=content-type1><span class=secno>4.1.1.2. </span><dfn
<h5 id=content-type1><span class=secno>4.1.1.2. </span><dfn
id=content-type10>Content-Type sniffing: unknown type</dfn></h5>

<ol>
<li>
<p>The user agent may wait for 512 or more bytes of the resource to be
available.

<li>
<p>Let <var title="">stream length</var> be the bigger of either 512 or
the number of bytes already available.

<li>
<p>For each row in the table below:</p>

<ol>
<li>Let <var title="">pattern length</var> be the length of the pattern
(number of bytes described by the cell in the second column of the
row).

<li>If <var title="">pattern length</var> is smaller than <var
title="">stream length</var> then skip this row.

<li>Apply the "and" operator to the first <var title="">pattern
length</var> bytes of the resource and the given mask (the bytes in the
cell of first column of that row), and let the result be the <var
title="">data</var>.

<li>If the bytes of the <var title="">data</var> matches the given
pattern bytes exactly, then the sniffed type of the resource is the
type given in the cell of the third column in that row; abort these
steps.
</ol>

<li>Otherwise, the <i>sniffed type</i> of the resource is unknown. User
agents should treat such content as "application/octect-stream".
</ol>

<table>
<thead>
<tr>
<th colspan=2>Bytes in Hexadecimal

<th>Sniffed type

<tr>
<th>Mask

<th>Pattern

<tbody>
<tr>
<td>ff ff 2f 2f 2f 2f 2f 2f 2f ff 2f 2f 2f 2f

<td>3c 31 44 4f 43 54 59 50 45 20 48 54 4D 4C <!-- "<!DOCTYPE HTML" -->

<td>text/html

<tr>
<td>ff 2f 2f 2f 2f

<td>3c 48 54 4d 4c <!-- "<HTML" -->

<td>text/html <!-- copied from the section below -->

<tbody>
<tr>
<td>ff ff ff ff ff ff

<td>47 49 46 38 37 61 <!-- GIF87a -->

<td>image/gif

<tr>
<td>ff ff ff ff ff ff

<td>47 49 46 38 39 61 <!-- GIF89a -->

<td>image/gif

<tr>
<td>ff ff ff ff ff ff ff ff

<td>89 50 4e 47 0d 0a 1a 0a
<!-- [TAB]PNG[CR][LF][EOF][LF]; 137 80 78 71 13 10 26 10 -->

<td>image/png

<tr>
<td>ff ff ff

<td>ff d8 ff
<!-- SOI marker followed by the first byte of another marker -->

<td>image/jpeg
</table>

<p>User agents may support further types if desired, by implicitly adding
to the above table. However, user agents must not use any other patterns
for types already mentioned in the table above.

<h5 id=content-type2><span class=secno>4.1.1.3. </span><dfn
id=content-type11>Content-Type sniffing: image</dfn></h5>

<ol>
<li>
<p>If the first bytes of the file match one of the byte sequences in the
first columns of the following table, then the sniffed type of the
resource is the type given in the corresponding cell in the second
column on the same row:</p>
<p>If the first bytes of the file match one of the byte sequences in the
first columns of the following table, then the sniffed type of the
resource is the type given in the corresponding cell in the second column
on the same row:

<table>
<thead>
<tr>
<th>Bytes in Hexadecimal
<table>
<thead>
<tr>
<th>Bytes in Hexadecimal

<th>Sniffed type
<th>Sniffed type <!-- update the table above if you change this! -->

<tbody>
<tr>
<td>47 49 46 38 37 61 <!-- GIF87a -->
<tbody>
<tr>
<td>47 49 46 38 37 61 <!-- GIF87a -->

<td>image/gif
<td>image/gif

<tr>
<td>47 49 46 38 39 61 <!-- GIF89a -->
<tr>
<td>47 49 46 38 39 61 <!-- GIF89a -->

<td>image/gif
<td>image/gif

<tr>
<td>89 50 4e 47 0d 0a 1a 0a
<!-- [TAB]PNG[CR][LF][EOF][LF]; 137 80 78 71 13 10 26 10 -->
<tr>
<td>89 50 4e 47 0d 0a 1a 0a
<!-- [TAB]PNG[CR][LF][EOF][LF]; 137 80 78 71 13 10 26 10 -->

<td>image/png
<td>image/png

<tr>
<td>ff d8 ff
<!-- SOI marker followed by the first byte of another marker -->
<tr>
<td>ff d8 ff
<!-- SOI marker followed by the first byte of another marker -->

<td>image/jpeg
</table>
<td>image/jpeg
</table>

<p>User agents must ignore any rows for image types that they do not
support.
<p>User agents must ignore any rows for image types that they do not
support.

<li>
<p>Otherwise, the <i>sniffed type</i> of the resource is the same as its
<i>official type</i>.
</ol>
<p>Otherwise, the <i>sniffed type</i> of the resource is the same as its
<i>official type</i>.

<h5 class=big-issue id=content-type3><span class=secno>4.1.1.4. </span><dfn
id=content-type12>Content-Type sniffing: feed or HTML</dfn></h5>
Expand Down Expand Up @@ -20468,7 +20561,7 @@ mpt says:
return the value of the <code>StyleSheet</code> interface's <code
title=dom-stylesheet-disabled>disabled</code> attribute on getting, and
forward the new value to that same attribute on setting.</p>
<!-- <p class="big-issue">Need more here -- defining preferred
<!-- <p class="big-issue">Need more here - defining preferred
stylesheets, alternate stylesheets, persistent stylesheets, ordering
of stylesheets, dynamic additions/removals, how it maps to
.styleSheets, HTTP Link: headers, and the stuff about the alternate
Expand Down
Loading

0 comments on commit bf67dd2

Please sign in to comment.