Bug 17100 - multipart/x-mixed-replace fails if charset is present in Content-Type header
Summary: multipart/x-mixed-replace fails if charset is present in Content-Type header
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Page Loading (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-01-30 13:40 PST by Matt Bishop
Modified: 2008-03-26 08:01 PDT (History)
3 users (show)

See Also:


Attachments
Multipart output html file (507.27 KB, text/plain)
2008-01-30 14:16 PST, Matt Bishop
no flags Details
PHP file to demonstrate this bug (536 bytes, text/plain)
2008-02-04 11:44 PST, Matt Bishop
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Bishop 2008-01-30 13:40:37 PST
Responses that are of Content-type:multipart/x-mixed-replace contain many multipart sections, each of which logically replaces the preceding section.

I am finding that as the response continues, Webkit does indeed replace the content of the page with the values, but Webkit's memory requirements grow along with the response lifetime.  I would expect it not to grow.

My evidence:

1. Activity tab shows the content of the response URL to grow apace the content stream.
2. Task Manager/Activity Monitor show the memory usage growing as well.
3. Drosera shows the entire content of the response stream rather than the current value, as expected. 

For a comparison, Firefox 2.0.0.11 Does not leak with the same content stream.
Comment 1 Matt Bishop 2008-01-30 14:16:37 PST
Created attachment 18800 [details]
Multipart output html file
Comment 2 Mark Rowe (bdash) 2008-01-31 08:49:37 PST
I set up the test case at <http://bdash.net.nz/files/multipart-mixed-replace.php> for easy access.
Comment 3 Mark Rowe (bdash) 2008-01-31 09:07:11 PST
I cannot reproduce any unusual memory growth while loading the test case.  "leaks" reports no unexpected leaks after loading the page either.
Comment 4 Matt Bishop 2008-01-31 11:43:49 PST
Hmm,

I think I need to put together a better test case.  The problem I see occurs while the content is streaming into the browser.  I am using this content-type for server push (I guess that is obvious) so the connection stays open indefinitely.

What type of CGI would you prefer? PHP, Perl, JSP?
Comment 5 Mark Rowe (bdash) 2008-01-31 12:02:00 PST
PHP or Perl would be fine.  I have a personal preference for PHP over Perl, but either of those would be great.
Comment 6 Matt Bishop 2008-02-04 11:44:26 PST
Created attachment 18912 [details]
PHP file to demonstrate this bug

The bug is triggered by the existence of a 'charset' element in the Content-Type header.  The PHP file has a working header and a bug-triggering header; the working header is commented out to make it easy to test.

This bug exists in the Windows version of Safari as well.  It works as expected (charset in header) on both Firefox 2 and Opera 9.

It is difficult, sometimes impossible, to remove the charset element from Content-Type, as app servers will automatically insert one if it is missing.
Comment 7 Matt Bishop 2008-02-04 11:46:50 PST
Changing description to match the bug
Comment 8 Matt Bishop 2008-03-25 09:55:09 PDT
Safari 3.1 for OS X and Windows still exhibit this bug.
Comment 9 Alexey Proskuryakov 2008-03-26 01:04:20 PDT
I have tried to reproduce this by leaving the page open for a few minutes, but the memory usage (I looked at RPRVT column in top) didn't grow beyond the original 13 Mb.

However, I also don't see it work correctly - new content is appended instead of replacing the old.

I'm using Safari 3.1 on Mac.
Comment 10 Matt Bishop 2008-03-26 07:24:35 PDT
The memory usage is ancillary--the real issue is that the content does not replace on the page as it should.
Comment 11 Alexey Proskuryakov 2008-03-26 08:00:10 PDT
OK, that I can confirm (got confused by the description, which talked about memory usage exclusively). Please file a separate bug about memory usage, if you are seeing it grow on pages without charset, too.
Comment 12 Alexey Proskuryakov 2008-03-26 08:01:00 PDT
<rdar://problem/5822305>