From 066f57a5fe77e1b91c80d0d96e26b503db17ca29 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Mon, 31 Mar 2003 20:58:02 +0000 Subject: [PATCH] Bug 199768 document.referrer is empty patch by keeda@hotpop.com r=sicking sr=peterv a=asa git-svn-id: svn://10.0.0.236/trunk@140463 18797224-902f-48f8-a5cc-f745e15eee43 --- .../content/html/document/src/nsHTMLDocument.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index bfd3d88441a..8b68ebc6418 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -756,18 +756,23 @@ nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsAString& aCharset, nsresult nsHTMLDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) { - nsAutoString lastModified; mHttpChannel = do_QueryInterface(aChannel); nsresult rv; if (mHttpChannel) { - nsCAutoString lastModHeader; + nsCAutoString header; rv = mHttpChannel->GetResponseHeader(NS_LITERAL_CSTRING("last-modified"), - lastModHeader); + header); if (NS_SUCCEEDED(rv)) { - CopyASCIItoUCS2(lastModHeader, lastModified); - SetLastModified(lastModified); + SetLastModified(NS_ConvertASCIItoUCS2(header)); + } + + // The misspelled key 'referer' is as per the HTTP spec + rv = mHttpChannel->GetRequestHeader(NS_LITERAL_CSTRING("referer"), + header); + if (NS_SUCCEEDED(rv)) { + SetReferrer(NS_ConvertASCIItoUCS2(header)); } } @@ -782,6 +787,7 @@ nsHTMLDocument::RetrieveRelevantHeaders(nsIChannel *aChannel) // file. Just don't set the last modified date on it... rv = file->GetLastModifiedTime(&modDate); if (NS_SUCCEEDED(rv)) { + nsAutoString lastModified; PRExplodedTime prtime; char buf[100]; PRInt64 intermediateValue;