From 213dd45019103e952ce36f129da33f0b5a8f1720 Mon Sep 17 00:00:00 2001 From: "pnunn%netscape.com" Date: Fri, 12 May 2000 01:37:02 +0000 Subject: [PATCH] bug#37909: add multipart support. pnunn, r:valeski@netscape.com --- gfx/src/nsImageNetContextAsync.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gfx/src/nsImageNetContextAsync.cpp b/gfx/src/nsImageNetContextAsync.cpp index bfa46d79b287..89c8497afeae 100644 --- a/gfx/src/nsImageNetContextAsync.cpp +++ b/gfx/src/nsImageNetContextAsync.cpp @@ -141,6 +141,7 @@ protected: PRInt32 mStatus; nsIChannel* mChannel; nsISupports* mUserContext; + PRBool mIsMulti; }; ImageConsumer::ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext) @@ -158,6 +159,7 @@ ImageConsumer::ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext) mStatus = 0; mChannel = nsnull; mUserContext = nsnull; + mIsMulti = PR_FALSE; } NS_IMPL_THREADSAFE_ADDREF(ImageConsumer) @@ -269,6 +271,8 @@ ImageConsumer::DoContent(const char * aContentType, || contentType.EqualsWithConversion("multipart/mixed")) { // if we're getting multipart data, we have to convert it. // so wedge the converter inbetween us and the consumer. + mIsMulti= PR_TRUE; + nsCOMPtr convServ = do_GetService(kStreamConvServiceCID, &rv); if (NS_FAILED(rv)) return rv; @@ -488,6 +492,7 @@ ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresul mStatus = MK_INTERRUPTED; } + // Since we're still holding on to the stream, there's still data // that needs to be read. So, pump the stream ourselves. if((mStream != nsnull) && (status == NS_BINDING_SUCCEEDED)) { @@ -528,8 +533,12 @@ ImageConsumer::OnStopRequest(nsIChannel* channel, nsISupports* aContext, nsresul reader->StreamAbort(mStatus); } else { - reader->StreamComplete(PR_FALSE); + reader->StreamComplete(mIsMulti); } + + if(mIsMulti) + mFirstRead = PR_TRUE; //reset to read new frame + reader->NetRequestDone(mURL, mStatus); NS_RELEASE(reader);