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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>4648</bug_id>
          
          <creation_ts>2005-08-25 02:25:39 -0700</creation_ts>
          <short_desc>Shockwave unable to load GZip&apos;d text resources when server sends Content-Length header</short_desc>
          <delta_ts>2007-08-16 05:38:14 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Plug-ins</component>
          <version>420+</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.kotska.com/swtest/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sulka Haro">sulka</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>17406</commentid>
    <comment_count>0</comment_count>
    <who name="Sulka Haro">sulka</who>
    <bug_when>2005-08-25 02:25:39 -0700</bug_when>
    <thetext>When a Shockwave movie loads an external text resource over HTTP and the delivery uses the gzip 
content-encoding, and the server sends the resource with the Content-Length 
header set, the download always fails for some reason. If the server doesn&apos;t send the Content-Length 
header and specifies &quot;Transfer-Encoding: chunked&quot;, the download succeeds.

Safari seems to misreport the file size to the plugin in the case of failure - for some reason the file 
size is reported as being larger than the gzipped version (correct) but smaller than the decompressed 
resource so it seems that if the plugin asks for details of the file while the file is being decompressed, 
the decompression is somehow interrupted and the length of the already decompressed content is 
reported.

Clearly there&apos;s some functional difference in how the content is delivered to plugins depending on the 
encoding type.

Reproducible: Always

Steps to Reproduce:

See http://www.kotska.com/swtest/ for a testcase.

Actual Results:
The file being downloaded is downloaded but never delivered to the plugin.

Expected Results:  
File should have been passed onto the plugin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17911</commentid>
    <comment_count>1</comment_count>
    <who name="Sulka Haro">sulka</who>
    <bug_when>2005-08-30 03:41:34 -0700</bug_when>
    <thetext>Tried this using both Safari 2.0.1 and the latest CVS version (AppleWebKit/420+ Safari/412.5) and the test 
fails using both. Effectively this means any site using Shockwave has to disable gzip compression for 
compatibility with Safari, causing textual content to require roughly 8-10x the amount of bandwidth 
necessary with compression.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>18988</commentid>
    <comment_count>2</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2005-09-07 04:25:37 -0700</bug_when>
    <thetext>Good test case</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35044</commentid>
    <comment_count>3</comment_count>
    <who name="Aldo Hoeben">aldo</who>
    <bug_when>2006-03-04 05:40:49 -0800</bug_when>
    <thetext>The testcase fails the same way in Firefox (1.0 and 1.5), both on OS X and Windows.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35367</commentid>
    <comment_count>4</comment_count>
    <who name="Sulka Haro">sulka</who>
    <bug_when>2006-03-07 02:10:58 -0800</bug_when>
    <thetext>The Firefox bug is reported here:

https://bugzilla.mozilla.org/show_bug.cgi?id=305766

FYI: Internet Explorer (Mac and Windows) doesn&apos;t fail the test and since the plugin running within those browsers is (afaik) exactly the same code on a given platform, there has to be some differences in the browser implementation.

We have 100k+ Mac users on our site every month and as a result of this bug, most of these users have to download about 300kB of extra unnecessarily uncompressed data on every visit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35444</commentid>
    <comment_count>5</comment_count>
      <attachid>6922</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-07 11:50:44 -0800</bug_when>
    <thetext>Created attachment 6922
proposed fix

Can we make automated tests for such bugs?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35483</commentid>
    <comment_count>6</comment_count>
      <attachid>6922</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2006-03-07 20:56:07 -0800</bug_when>
    <thetext>Comment on attachment 6922
proposed fix

This patch is not quite right. The content encoding might be &quot;identity&quot;, so just the presence of a content encoding header field is not the correct check. Also, buggy servers sometimes send strings like &quot;identity, identity&quot;.

It&apos;s hard to code this correctly at the WebKit level and stay in sync. with the features of the NSURL level; ideally we would have a Foundation method like expectedContentLength, but one that knew to only give us the length for things it won&apos;t decode. In general we don&apos;t want code that has to second-guess what NSURL is doing for us.

Current versions of NSURLConnection support &quot;deflate&quot; and &quot;gzip&quot;; anything else is treated as &quot;identity&quot;. The comparison is done in a case insensitive manner. NSURLConnection knows how to parse off an optional &quot;x-&quot; prefix. It knows how to ignore parameters that come after an optional &quot;;&quot; separator. It knows how to ignore whitespace. It parses a list separated by commas; if all the items in the list are the same (ignoring case, whitespace, &quot;x-&quot; prefixes, and parameters) then it uses it, otherwise it treats it as &quot;identity&quot;.

Hard-coding this precise rule into WebBaseNetscapePluginStream would be kinda lame, but I don&apos;t have a better idea.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35497</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-08 00:49:20 -0800</bug_when>
    <thetext>&lt;rdar://4470599&gt; for NSURLConnection.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>35887</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-03-11 04:36:25 -0800</bug_when>
    <thetext>Actually, I think that expectedContentLength itself should only give us the length for things it won&apos;t decode, so I&apos;m going to just wait for the resolution of the above Radar.

That said, I still don&apos;t really understand why a simplified rule like the one used in the patch is much worse for deciding what to pass to the plugin. Also, servers SHOULD NOT send Content-Encoding: identity, according to RFC2616.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2456</commentid>
    <comment_count>9</comment_count>
      <attachid>15938</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2007-08-12 03:21:47 -0700</bug_when>
    <thetext>Created attachment 15938
updated fix

As mentioned above, I think we do not need to match NSURLConnection logic particularly well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2463</commentid>
    <comment_count>10</comment_count>
      <attachid>15938</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2007-08-12 12:05:47 -0700</bug_when>
    <thetext>Comment on attachment 15938
updated fix

OK, at this point it seems smart to work around the NSURL bug. r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2466</commentid>
    <comment_count>11</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2007-08-12 12:26:02 -0700</bug_when>
    <thetext>Committed revision 25024.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2189</commentid>
    <comment_count>12</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-08-16 05:38:10 -0700</bug_when>
    <thetext>&lt;rdar://problem/5415340&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>6922</attachid>
            <date>2006-03-07 11:50:44 -0800</date>
            <delta_ts>2007-08-12 03:21:47 -0700</delta_ts>
            <desc>proposed fix</desc>
            <filename>4648r1_patch.txt</filename>
            <type>text/plain</type>
            <size>1130</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdC9QbHVnaW5zL1dlYkJhc2VOZXRzY2FwZVBsdWdpblN0cmVhbS5tCj09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT0KLS0tIFdlYktpdC9QbHVnaW5z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gICBleHBlY3Rl
ZENvbnRlbnRMZW5ndGg6ZXhwZWN0ZWRDb250ZW50TGVuZ3RoCiAgICAgICAgICAgICAgICAgbGFz
dE1vZGlmaWVkRGF0ZTpXS0dldE5TVVJMUmVzcG9uc2VMYXN0TW9kaWZpZWREYXRlKHIpCiAgICAg
ICAgICAgICAgICAgICAgICAgICBNSU1FVHlwZTpbciBNSU1FVHlwZV1dOwogfQo=
</data>
<flag name="review"
          id="1787"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>15938</attachid>
            <date>2007-08-12 03:21:47 -0700</date>
            <delta_ts>2007-08-12 12:05:47 -0700</delta_ts>
            <desc>updated fix</desc>
            <filename>4648r2_patch.txt</filename>
            <type>text/plain</type>
            <size>2451</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYktpdC9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gV2ViS2l0L0NoYW5nZUxvZwko
cmV2aXNpb24gMjUwMTYpCisrKyBXZWJLaXQvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBAIC0x
LDMgKzEsMTQgQEAKKzIwMDctMDgtMTIgIEFsZXhleSBQcm9za3VyeWFrb3YgIDxhcEB3ZWJraXQu
b3JnPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIGh0
dHA6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTQ2NDgKKyAgICAgICAgU2hvY2t3
YXZlIHVuYWJsZSB0byBsb2FkIEdaaXAnZCB0ZXh0IHJlc291cmNlcyB3aGVuIHNlcnZlciBzZW5k
cyBDb250ZW50LUxlbmd0aCBoZWFkZXIKKworICAgICAgICAqIFBsdWdpbnMvV2ViQmF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gLy8gc3RhcnRTdHJlYW1SZXNwb25zZVVSTDouLi4gd2lsbCBudWxsLXRl
cm1pbmF0ZS4KICAgICB9CiAKICAgICBbc2VsZiBzdGFydFN0cmVhbVJlc3BvbnNlVVJMOltyIFVS
TF0KLSAgICAgICAgICAgZXhwZWN0ZWRDb250ZW50TGVuZ3RoOltyIGV4cGVjdGVkQ29udGVudExl
bmd0aF0KKyAgICAgICAgICAgZXhwZWN0ZWRDb250ZW50TGVuZ3RoOmV4cGVjdGVkQ29udGVudExl
bmd0aAogICAgICAgICAgICAgICAgIGxhc3RNb2RpZmllZERhdGU6V0tHZXROU1VSTFJlc3BvbnNl
TGFzdE1vZGlmaWVkRGF0ZShyKQogICAgICAgICAgICAgICAgICAgICAgICAgTUlNRVR5cGU6W3Ig
TUlNRVR5cGVdCiAgICAgICAgICAgICAgICAgICAgICAgICAgaGVhZGVyczp0aGVIZWFkZXJzXTsK
</data>
<flag name="review"
          id="6680"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>