diff --git a/modules/plugin/base/src/nsPluginHostImpl.cpp b/modules/plugin/base/src/nsPluginHostImpl.cpp index d3fb9d20a0cb..f7fee1e69f9c 100644 --- a/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -2065,6 +2065,22 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request, mPluginStreamInfo->SetSeekable(bSeekable); + PRUint32 length = -1; + mPluginStreamInfo->GetLength(&length); + if (bSeekable && length == -1 && httpChannel) { + nsXPIDLCString tmp; + httpChannel->GetResponseHeader("Content-Length", getter_Copies(tmp)); + if (tmp.get()) { + PRInt32 ignore; + nsCString lenString (tmp.get()); + length = lenString.ToInteger(&ignore); + mPluginStreamInfo->SetLength(length); + } + } + if (length == -1) + mPluginStreamInfo->SetSeekable(PR_FALSE); + + // we require a content len // get Last-Modified header for plugin info if (httpChannel) { diff --git a/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/modules/plugin/nglsrc/nsPluginHostImpl.cpp index d3fb9d20a0cb..f7fee1e69f9c 100644 --- a/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -2065,6 +2065,22 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request, mPluginStreamInfo->SetSeekable(bSeekable); + PRUint32 length = -1; + mPluginStreamInfo->GetLength(&length); + if (bSeekable && length == -1 && httpChannel) { + nsXPIDLCString tmp; + httpChannel->GetResponseHeader("Content-Length", getter_Copies(tmp)); + if (tmp.get()) { + PRInt32 ignore; + nsCString lenString (tmp.get()); + length = lenString.ToInteger(&ignore); + mPluginStreamInfo->SetLength(length); + } + } + if (length == -1) + mPluginStreamInfo->SetSeekable(PR_FALSE); + + // we require a content len // get Last-Modified header for plugin info if (httpChannel) { diff --git a/netwerk/protocol/http/src/nsHttpTransaction.cpp b/netwerk/protocol/http/src/nsHttpTransaction.cpp index 1012c7e42ad0..3c37c2adef42 100644 --- a/netwerk/protocol/http/src/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/src/nsHttpTransaction.cpp @@ -434,8 +434,12 @@ nsHttpTransaction::HandleContentStart() // eliminate any references to this content length value, so our // consumers don't get confused. mContentLength = -1; - mResponseHead->SetHeader(nsHttp::Content_Length, nsnull); mResponseHead->SetContentLength(-1); + // if a client is really interested in the content length, + // even though we think it is invalid, them them hut for it + // in the raw headers. + // mResponseHead->SetHeader(nsHttp::Content_Length, nsnull); + } }