From 87b79bdc01ca94b37c72776287c14b92aff18f08 Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Tue, 20 Oct 1998 00:18:19 +0000 Subject: [PATCH] Raptor only. Extending the META tag http-equiv handling code to handle arbitrary http-equivs. We were previously just handing the "Refresh" case. git-svn-id: svn://10.0.0.236/trunk@13149 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 22 ++++++++++++------- .../html/document/src/nsHTMLContentSink.cpp | 22 ++++++++++++------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 92c1ec40667..77e720f5290 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -2070,23 +2070,29 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) } mHead->AppendChildTo(it, PR_FALSE); - // If we are processing an HTTP url, handle the Refresh Case. We - // could also handle the other http-equiv cases here such as - // "Content-type". + // If we are processing an HTTP url, handle meta http-equiv cases nsIHttpUrl* httpUrl = nsnull; rv = mDocumentURL->QueryInterface(kIHTTPUrlIID, (void **)&httpUrl); if (NS_OK == rv) { - nsAutoString result; - it->GetAttribute(nsHTMLAtoms::httpEquiv, result); - if (result.EqualsIgnoreCase("REFRESH")) { + nsAutoString header; + it->GetAttribute(nsHTMLAtoms::httpEquiv, header); + if (header.Length() > 0) { + nsAutoString result; it->GetAttribute(nsHTMLAtoms::content, result); if (result.Length() > 0) { - char* value = result.ToNewCString(); + char* value = result.ToNewCString(), *csHeader; if (!value) { NS_RELEASE(it); return NS_ERROR_OUT_OF_MEMORY; } - httpUrl->AddMimeHeader("REFRESH", value); + csHeader = header.ToNewCString(); + if (!csHeader) { + delete value; + NS_RELEASE(it); + return NS_ERROR_OUT_OF_MEMORY; + } + httpUrl->AddMimeHeader(csHeader, value); + delete csHeader; delete value; } } diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index 92c1ec40667..77e720f5290 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -2070,23 +2070,29 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) } mHead->AppendChildTo(it, PR_FALSE); - // If we are processing an HTTP url, handle the Refresh Case. We - // could also handle the other http-equiv cases here such as - // "Content-type". + // If we are processing an HTTP url, handle meta http-equiv cases nsIHttpUrl* httpUrl = nsnull; rv = mDocumentURL->QueryInterface(kIHTTPUrlIID, (void **)&httpUrl); if (NS_OK == rv) { - nsAutoString result; - it->GetAttribute(nsHTMLAtoms::httpEquiv, result); - if (result.EqualsIgnoreCase("REFRESH")) { + nsAutoString header; + it->GetAttribute(nsHTMLAtoms::httpEquiv, header); + if (header.Length() > 0) { + nsAutoString result; it->GetAttribute(nsHTMLAtoms::content, result); if (result.Length() > 0) { - char* value = result.ToNewCString(); + char* value = result.ToNewCString(), *csHeader; if (!value) { NS_RELEASE(it); return NS_ERROR_OUT_OF_MEMORY; } - httpUrl->AddMimeHeader("REFRESH", value); + csHeader = header.ToNewCString(); + if (!csHeader) { + delete value; + NS_RELEASE(it); + return NS_ERROR_OUT_OF_MEMORY; + } + httpUrl->AddMimeHeader(csHeader, value); + delete csHeader; delete value; } }