зеркало из https://github.com/mozilla/gecko-dev.git
fixes bug 90288 (part 2) "not honoring Pragma: no-cache from HTTP-EQUIV"
r=gagan, sr=dougt
This commit is contained in:
Родитель
e0d6e9d4fe
Коммит
f15b47c6af
|
@ -4570,6 +4570,7 @@ HTMLContentSink::ProcessHTTPHeaders(nsIChannel* aChannel) {
|
||||||
char* headers[]={"link","default-style","content-base",0}; // add more http headers if you need
|
char* headers[]={"link","default-style","content-base",0}; // add more http headers if you need
|
||||||
char** name=headers;
|
char** name=headers;
|
||||||
nsXPIDLCString tmp;
|
nsXPIDLCString tmp;
|
||||||
|
|
||||||
while(*name) {
|
while(*name) {
|
||||||
httpchannel->GetResponseHeader(*name, getter_Copies(tmp));
|
httpchannel->GetResponseHeader(*name, getter_Copies(tmp));
|
||||||
if(tmp.get()) {
|
if(tmp.get()) {
|
||||||
|
@ -4595,6 +4596,8 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAReadableString& aVa
|
||||||
nsresult rv=NS_OK;
|
nsresult rv=NS_OK;
|
||||||
// XXX necko isn't going to process headers coming in from the parser
|
// 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)");
|
//NS_WARNING("need to fix how necko adds mime headers (in HTMLContentSink::ProcessMETATag)");
|
||||||
|
|
||||||
|
mDocument->SetHeaderData(aHeader, aValue);
|
||||||
|
|
||||||
// see if we have a refresh "header".
|
// see if we have a refresh "header".
|
||||||
if (aHeader == nsHTMLAtoms::refresh) {
|
if (aHeader == nsHTMLAtoms::refresh) {
|
||||||
|
@ -4637,10 +4640,7 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAReadableString& aVa
|
||||||
nsCRT::free(cookie);
|
nsCRT::free(cookie);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
} // END set-cookie
|
} // END set-cookie
|
||||||
|
else if (aHeader == nsHTMLAtoms::link) {
|
||||||
mDocument->SetHeaderData(aHeader, aValue);
|
|
||||||
|
|
||||||
if (aHeader == nsHTMLAtoms::link) {
|
|
||||||
rv = ProcessLink(aContent, aValue);
|
rv = ProcessLink(aContent, aValue);
|
||||||
}
|
}
|
||||||
else if (aHeader == nsHTMLAtoms::headerContentBase) {
|
else if (aHeader == nsHTMLAtoms::headerContentBase) {
|
||||||
|
@ -4649,6 +4649,24 @@ HTMLContentSink::ProcessHeaderData(nsIAtom* aHeader,const nsAReadableString& aVa
|
||||||
else if (aHeader == nsHTMLAtoms::headerWindowTarget) {
|
else if (aHeader == nsHTMLAtoms::headerWindowTarget) {
|
||||||
ProcessBaseTarget(aValue);
|
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;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ class nsIRequestObserver;
|
||||||
class nsIParserFilter;
|
class nsIParserFilter;
|
||||||
class nsString;
|
class nsString;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
|
class nsIChannel;
|
||||||
|
|
||||||
enum eParserCommands {
|
enum eParserCommands {
|
||||||
eViewNormal,
|
eViewNormal,
|
||||||
|
@ -203,6 +203,13 @@ class nsIParser : public nsISupports {
|
||||||
*/
|
*/
|
||||||
virtual nsresult CreateTagStack(nsITagStack** aTagStack)=0;
|
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
|
* Get the DTD associated with this parser
|
||||||
|
|
|
@ -2881,6 +2881,21 @@ nsresult nsParser::CreateTagStack(nsITagStack** aTagStack){
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
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
|
* Get the DTD associated with this parser
|
||||||
* @update vidur 9/29/99
|
* @update vidur 9/29/99
|
||||||
|
|
|
@ -289,6 +289,14 @@ class nsParser : public nsIParser,
|
||||||
*/
|
*/
|
||||||
virtual nsresult CreateTagStack(nsITagStack** aTagStack);
|
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
|
* Get the DTD associated with this parser
|
||||||
* @update vidur 9/29/99
|
* @update vidur 9/29/99
|
||||||
|
|
|
@ -56,7 +56,7 @@ class nsIRequestObserver;
|
||||||
class nsIParserFilter;
|
class nsIParserFilter;
|
||||||
class nsString;
|
class nsString;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
|
class nsIChannel;
|
||||||
|
|
||||||
enum eParserCommands {
|
enum eParserCommands {
|
||||||
eViewNormal,
|
eViewNormal,
|
||||||
|
@ -203,6 +203,13 @@ class nsIParser : public nsISupports {
|
||||||
*/
|
*/
|
||||||
virtual nsresult CreateTagStack(nsITagStack** aTagStack)=0;
|
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
|
* Get the DTD associated with this parser
|
||||||
|
|
|
@ -2881,6 +2881,21 @@ nsresult nsParser::CreateTagStack(nsITagStack** aTagStack){
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
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
|
* Get the DTD associated with this parser
|
||||||
* @update vidur 9/29/99
|
* @update vidur 9/29/99
|
||||||
|
|
|
@ -289,6 +289,14 @@ class nsParser : public nsIParser,
|
||||||
*/
|
*/
|
||||||
virtual nsresult CreateTagStack(nsITagStack** aTagStack);
|
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
|
* Get the DTD associated with this parser
|
||||||
* @update vidur 9/29/99
|
* @update vidur 9/29/99
|
||||||
|
|
Загрузка…
Ссылка в новой задаче