<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>19799</bug_id>
          
          <creation_ts>2012-10-31 18:55:08 +0000</creation_ts>
          <short_desc>Make sniffing sub-algorithms callable without the main algorithm</short_desc>
          <delta_ts>2012-11-01 15:40:59 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>MIME</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Gordon P. Hemsley">gphemsley</assigned_to>
          <cc>ian</cc>
    
    <cc>mike</cc>
          
          <qa_contact>sideshowbarker+mimespec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>77537</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-31 18:55:08 +0000</bug_when>
    <thetext>The HTML spec invokes &quot;rules for distinguishing if a resource is text or binary&quot; directly, so &quot;resource header&quot; isn&apos;t defined when the algorithm is invoked.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77543</commentid>
    <comment_count>1</comment_count>
    <who name="Gordon P. Hemsley">gphemsley</who>
    <bug_when>2012-10-31 19:29:41 +0000</bug_when>
    <thetext>Ah, you&apos;re right. I&apos;d tried to avoid that from happening just yet, but it appears I was unsuccessful.

You should map the terms you use as follows:

* &quot;rules for sniffing images specifically&quot; =&gt; &quot;media type sniffing algorithm with the &apos;sniff-images&apos; flag set&quot;
* &quot;rules for distinguishing if a resource is text or binary&quot; =&gt; &quot;media type sniffing algorithm with the &apos;sniff-text-or-binary&apos; flag set&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77595</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-10-31 22:23:13 +0000</bug_when>
    <thetext>Why? That seems... less clear. All it does is add an extra level of indirection. Also it is inefficient, e.g. the &lt;object&gt; algorithm only calls the &quot;text or binary&quot; algorithm if the type is known to be text/plain, at which point why would we want to go through the algorithm that checks the octets again? That wouldn&apos;t get the right effect (e.g. if it&apos;s TEXT/PLAIN). The whole point is to skip that check.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77666</commentid>
    <comment_count>3</comment_count>
    <who name="Gordon P. Hemsley">gphemsley</who>
    <bug_when>2012-11-01 15:03:29 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Why? That seems... less clear. All it does is add an extra level of
&gt; indirection. Also it is inefficient, e.g. the &lt;object&gt; algorithm only calls
&gt; the &quot;text or binary&quot; algorithm if the type is known to be text/plain, at
&gt; which point why would we want to go through the algorithm that checks the
&gt; octets again? That wouldn&apos;t get the right effect (e.g. if it&apos;s TEXT/PLAIN).
&gt; The whole point is to skip that check.

I see; I wasn&apos;t familiar with how you were invoking the algorithm.

I&apos;ll fix it so that it can do both. (See also bug 19802 comment 3.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>77677</commentid>
    <comment_count>4</comment_count>
    <who name="Gordon P. Hemsley">gphemsley</who>
    <bug_when>2012-11-01 15:40:59 +0000</bug_when>
    <thetext>I&apos;ve abstracted the definitions of &quot;resource header&quot; and &quot;read the resource header&quot; out of the main sniffing algorithm:

https://github.com/whatwg/mimesniff/commit/8fd3b5e2d026df7ac2748f6049e8707ab0efe934

I believe this fixes the problem; if it doesn&apos;t, reopen the bug.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>