fixes bug 90288 (part 2) "not honoring Pragma: no-cache from HTTP-EQUIV"

r=gagan, sr=dougt
This commit is contained in:
darin%netscape.com 2001-08-22 00:38:46 +00:00
parent e0d6e9d4fe
commit f15b47c6af
7 changed files with 84 additions and 6 deletions

View File

@ -4570,6 +4570,7 @@ HTMLContentSink::ProcessHTTPHeaders(nsIChannel* aChannel) {
char* headers[]={"link","default-style","content-base",0}; // add more http headers if you need
char** name=headers;
nsXPIDLCString tmp;
while(*name) {
httpchannel->GetResponseHeader(*name, getter_Copies(tmp));
if(tmp.get()) {
@ -4595,6 +4596,8 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAReadableString& aVa
nsresult rv=NS_OK;
// XXX necko isn't going to process headers coming in from the parser
//NS_WARNING("need to fix how necko adds mime headers (in HTMLContentSink::ProcessMETATag)");
mDocument->SetHeaderData(aHeader, aValue);
// see if we have a refresh "header".
if (aHeader == nsHTMLAtoms::refresh) {
@ -4637,10 +4640,7 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAReadableString& aVa
nsCRT::free(cookie);
if (NS_FAILED(rv)) return rv;
} // END set-cookie
mDocument->SetHeaderData(aHeader, aValue);
if (aHeader == nsHTMLAtoms::link) {
else if (aHeader == nsHTMLAtoms::link) {
rv = ProcessLink(aContent, aValue);
}
else if (aHeader == nsHTMLAtoms::headerContentBase) {
@ -4649,6 +4649,24 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAReadableString& aVa
else if (aHeader == nsHTMLAtoms::headerWindowTarget) {
ProcessBaseTarget(aValue);
}
else {
// we also need to report back HTTP-EQUIV headers to the channel
// so that it can process things like pragma: no-cache or other
// cache-control headers. Ideally this should also be the way for
// cookies to be set! But we'll worry about that in the next
// iteration
nsCOMPtr<nsIChannel> channel;
if (NS_SUCCEEDED(mParser->GetChannel(getter_AddRefs(channel)))) {
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
if (httpChannel) {
const PRUnichar *header = 0;
(void)aHeader->GetUnicode(&header);
(void)httpChannel->SetResponseHeader(
NS_ConvertUCS2toUTF8(header).get(),
NS_ConvertUCS2toUTF8(aValue).get());
}
}
}
return rv;
}

View File

@ -56,7 +56,7 @@ class nsIRequestObserver;
class nsIParserFilter;
class nsString;
class nsIURI;
class nsIChannel;
enum eParserCommands {
eViewNormal,
@ -203,6 +203,13 @@ class nsIParser : public nsISupports {
*/
virtual nsresult CreateTagStack(nsITagStack** aTagStack)=0;
/**
* Get the channel associated with this parser
* @update harishd,gagan 07/17/01
* @param aChannel out param that will contain the result
* @return NS_OK if successful
*/
NS_IMETHOD GetChannel(nsIChannel** aChannel) = 0;
/**
* Get the DTD associated with this parser

View File

@ -2881,6 +2881,21 @@ nsresult nsParser::CreateTagStack(nsITagStack** aTagStack){
return NS_ERROR_OUT_OF_MEMORY;
}
/**
* Get the channel associated with this parser
* @update harishd,gagan 07/17/01
* @param aChannel out param that will contain the result
* @return NS_OK if successful
*/
NS_IMETHODIMP
nsParser::GetChannel(nsIChannel** aChannel)
{
nsresult result = NS_ERROR_NOT_AVAILABLE;
if (mParserContext && mParserContext->mRequest)
result = CallQueryInterface(mParserContext->mRequest, aChannel);
return result;
}
/**
* Get the DTD associated with this parser
* @update vidur 9/29/99

View File

@ -289,6 +289,14 @@ class nsParser : public nsIParser,
*/
virtual nsresult CreateTagStack(nsITagStack** aTagStack);
/**
* Get the channel associated with this parser
* @update harishd,gagan 07/17/01
* @param aChannel out param that will contain the result
* @return NS_OK if successful
*/
NS_IMETHOD GetChannel(nsIChannel** aChannel);
/**
* Get the DTD associated with this parser
* @update vidur 9/29/99

View File

@ -56,7 +56,7 @@ class nsIRequestObserver;
class nsIParserFilter;
class nsString;
class nsIURI;
class nsIChannel;
enum eParserCommands {
eViewNormal,
@ -203,6 +203,13 @@ class nsIParser : public nsISupports {
*/
virtual nsresult CreateTagStack(nsITagStack** aTagStack)=0;
/**
* Get the channel associated with this parser
* @update harishd,gagan 07/17/01
* @param aChannel out param that will contain the result
* @return NS_OK if successful
*/
NS_IMETHOD GetChannel(nsIChannel** aChannel) = 0;
/**
* Get the DTD associated with this parser

View File

@ -2881,6 +2881,21 @@ nsresult nsParser::CreateTagStack(nsITagStack** aTagStack){
return NS_ERROR_OUT_OF_MEMORY;
}
/**
* Get the channel associated with this parser
* @update harishd,gagan 07/17/01
* @param aChannel out param that will contain the result
* @return NS_OK if successful
*/
NS_IMETHODIMP
nsParser::GetChannel(nsIChannel** aChannel)
{
nsresult result = NS_ERROR_NOT_AVAILABLE;
if (mParserContext && mParserContext->mRequest)
result = CallQueryInterface(mParserContext->mRequest, aChannel);
return result;
}
/**
* Get the DTD associated with this parser
* @update vidur 9/29/99

View File

@ -289,6 +289,14 @@ class nsParser : public nsIParser,
*/
virtual nsresult CreateTagStack(nsITagStack** aTagStack);
/**
* Get the channel associated with this parser
* @update harishd,gagan 07/17/01
* @param aChannel out param that will contain the result
* @return NS_OK if successful
*/
NS_IMETHOD GetChannel(nsIChannel** aChannel);
/**
* Get the DTD associated with this parser
* @update vidur 9/29/99