From f97aecfa0a6dca3c105dfde9d78d01469217461a Mon Sep 17 00:00:00 2001 From: "peterlubczynski%netscape.com" Date: Tue, 12 Dec 2000 01:00:28 +0000 Subject: [PATCH] Set lastModified attribute for a plugin stream b=58134 a=av sr=buster git-svn-id: svn://10.0.0.236/trunk@83507 18797224-902f-48f8-a5cc-f745e15eee43 --- .../plugin/base/src/nsPluginHostImpl.cpp | 20 ++++++++++++++++++- .../plugin/nglsrc/nsPluginHostImpl.cpp | 20 ++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index c51e5929ef1..8768a37f696 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -1359,7 +1359,25 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIChannel* channel, mSetUpListener = PR_TRUE; mPluginStreamInfo->SetSeekable(PR_FALSE); - //mPluginStreamInfo->SetModified(??); + + // get Last-Modified header for plugin info + nsCOMPtr theHTTPChannel = do_QueryInterface(channel); + if (theHTTPChannel) { + char * lastModified; + nsCOMPtr header = NS_NewAtom("last-modified"); + + theHTTPChannel->GetResponseHeader(header, &lastModified); + if (lastModified) { + PRTime time64; + PR_ParseTimeString(lastModified, PR_TRUE, &time64); //convert string time to interger time + + // Convert PRTime to unix-style time_t, i.e. seconds since the epoch + double fpTime; + LL_L2D(fpTime, time64); + mPluginStreamInfo->SetLastModified((PRUint32)(fpTime * 1e-6 + 0.5)); + nsCRT::free(lastModified); + } + } char* urlString; aURL->GetSpec(&urlString); diff --git a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp index c51e5929ef1..8768a37f696 100644 --- a/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp @@ -1359,7 +1359,25 @@ nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIChannel* channel, mSetUpListener = PR_TRUE; mPluginStreamInfo->SetSeekable(PR_FALSE); - //mPluginStreamInfo->SetModified(??); + + // get Last-Modified header for plugin info + nsCOMPtr theHTTPChannel = do_QueryInterface(channel); + if (theHTTPChannel) { + char * lastModified; + nsCOMPtr header = NS_NewAtom("last-modified"); + + theHTTPChannel->GetResponseHeader(header, &lastModified); + if (lastModified) { + PRTime time64; + PR_ParseTimeString(lastModified, PR_TRUE, &time64); //convert string time to interger time + + // Convert PRTime to unix-style time_t, i.e. seconds since the epoch + double fpTime; + LL_L2D(fpTime, time64); + mPluginStreamInfo->SetLastModified((PRUint32)(fpTime * 1e-6 + 0.5)); + nsCRT::free(lastModified); + } + } char* urlString; aURL->GetSpec(&urlString);