Bug 23402

Summary: multipart/x-mixed-replace doesn't close connection when img removed with Javascript
Product: WebKit Reporter: Daniel Welty <dj88welty>
Component: ImagesAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Minor CC: ap, dougnorton
Priority: P2 Keywords: InRadar, NeedsReduction
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.4   
URL: http://r02sdelc.device.mst.edu:8000/ipod/

Description Daniel Welty 2009-01-16 21:41:58 PST
Upon clicking on any of the items in the list at http://r02sdelc.device.mst.edu:8000/ipod/, the webcam loads.  The problem occurs when "Back to List" is clicked.  The javascript removes the img element for the webcam, but the connection stays open, still streaming data for many minutes afterwards.  The connection only closes when the tab/window is closed, or a new page is loaded in that tab.  This is most noticeable in the network activity monitor, and if multiple cameras are opened, one at a time, their connections will build up.
The webcams stream by using multipart/x-mixed-replace http push.  This happens at least with Webkit 525.x through 528+.
Comment 1 Mark Rowe (bdash) 2009-01-16 22:16:30 PST
<rdar://problem/6504892>
Comment 2 Doug Norton 2011-12-15 10:12:52 PST
I find this is still the case with 535.14 and on iOS 5.0.1. If you replace the mjpeg to a jpg by setting the src. The image in the webpage is updated to the jpg image but the connection to the mjpeg stays open and continues to stream.

The iPhone does close the connection when a user switches out of the webapp, which is good. But if the user stays in the webapp but is no longer viewing the mjpeg, the connection stays open and bytes are transferred.

I can set up a test case if this would help get this fixed.