diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index ad3146a1d56..9c5223c2e69 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -4513,23 +4513,6 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) header.ToLowerCase(); nsCOMPtr fieldAtom(dont_AddRef(NS_NewAtom(header))); rv=ProcessHeaderData(fieldAtom,result,it); - - // 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 channel; - if (mParser && - NS_SUCCEEDED(mParser->GetChannel(getter_AddRefs(channel)))) - { - nsCOMPtr - httpchannel(do_QueryInterface(channel)); - if (httpchannel) - (void)httpchannel->SetEquivHeader( - NS_ConvertUCS2toUTF8(header).get(), - NS_ConvertUCS2toUTF8(result).get()); - } }//if (result.Length() > 0) }//if (header.Length() > 0) }//if (!mFrameset || !mDocument) @@ -4551,7 +4534,6 @@ 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()) { diff --git a/mozilla/htmlparser/src/nsIParser.h b/mozilla/htmlparser/src/nsIParser.h index d4321197080..e8dbfe8113d 100644 --- a/mozilla/htmlparser/src/nsIParser.h +++ b/mozilla/htmlparser/src/nsIParser.h @@ -58,7 +58,7 @@ class nsIRequestObserver; class nsIParserFilter; class nsString; class nsIURI; -class nsIChannel; + enum eParserCommands { eViewNormal, @@ -205,13 +205,6 @@ 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 diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index 9898a799f73..5d0653cf842 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -2884,23 +2884,6 @@ 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 = mParserContext->mRequest->QueryInterface(NS_GET_IID(nsIChannel), - (void**)aChannel); - } - return result; -} - /** * Get the DTD associated with this parser * @update vidur 9/29/99 diff --git a/mozilla/htmlparser/src/nsParser.h b/mozilla/htmlparser/src/nsParser.h index 6c8f206a036..e96a83619b8 100644 --- a/mozilla/htmlparser/src/nsParser.h +++ b/mozilla/htmlparser/src/nsParser.h @@ -289,14 +289,6 @@ 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 diff --git a/mozilla/netwerk/protocol/http/public/nsIHttpChannel.idl b/mozilla/netwerk/protocol/http/public/nsIHttpChannel.idl index 3eaaef9d523..76c981824b3 100644 --- a/mozilla/netwerk/protocol/http/public/nsIHttpChannel.idl +++ b/mozilla/netwerk/protocol/http/public/nsIHttpChannel.idl @@ -82,12 +82,6 @@ interface nsIHttpChannel : nsIChannel void setResponseHeader(in string header, in string value); void visitResponseHeaders(in nsIHttpHeaderVisitor visitor); - /** - * Set the headers that came in the content (HTML really)-- all the - * HTTP-EQUIV headers (e.g. Pragma no-cache, etc.) - */ - void setEquivHeader(in string header, in string value); - /** * Get the charset for the response, which may be NULL if not specified * by the server (ie. the Content-Type header may not specify a charset). diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp index 218556c6cd2..a98c5d3214c 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -64,7 +64,6 @@ nsHttpChannel::nsHttpChannel() , mTriedCredentialsFromPrehost(PR_FALSE) , mFromCacheOnly(PR_FALSE) , mCachedContentIsValid(PR_FALSE) - , mCheckForCacheReusability(PR_FALSE) { LOG(("Creating nsHttpChannel @%x\n", this)); @@ -494,7 +493,7 @@ nsHttpChannel::ProcessNotModified() // merge any new headers with the cached response headers rv = mCachedResponseHead->UpdateHeaders(mResponseHead->Headers()); if (NS_FAILED(rv)) return rv; - + // update the cached response head nsCAutoString head; mCachedResponseHead->Flatten(head, PR_TRUE); @@ -583,7 +582,6 @@ nsHttpChannel::OpenCacheEntry(PRBool *delayed) else accessRequested = nsICache::ACCESS_READ_WRITE; // normal browsing - // we'll try to synchronously open the cache entry... however, it may be // in use and not yet validated, in which case we'll try asynchronously // opening the cache entry. @@ -600,13 +598,6 @@ nsHttpChannel::OpenCacheEntry(PRBool *delayed) mCacheEntry->GetAccessGranted(&mCacheAccess); LOG(("got cache entry [access=%x]\n", mCacheAccess)); } - - // if the client was willing to contact the server (rw) - // and the cache is giving us a readonly then we need to - // check for the special case of mini-validation before reusing - // the cached copy. - if (accessRequested > mCacheAccess) - mCheckForCacheReusability = PR_TRUE; return rv; } @@ -713,8 +704,7 @@ nsHttpChannel::CheckCache() buf.Adopt(0); // If we were only granted read access, then assume the entry is valid. - // only if mCheckForCacheReusability is not set... - if ((mCacheAccess == nsICache::ACCESS_READ) && !mCheckForCacheReusability) { + if (mCacheAccess == nsICache::ACCESS_READ) { mCachedContentIsValid = PR_TRUE; return NS_OK; } @@ -737,18 +727,6 @@ nsHttpChannel::CheckCache() } PRBool doValidation = PR_FALSE; - PRBool usableCacheEntry = PR_TRUE; - // The cached entry may have a pragma no-cache case as well-- if so then - // mCachedContentIsValid is false and so return... - // TODO later on expand to cache-control headers as well. - const char * val = mCachedResponseHead->PeekHeader(nsHttp::Pragma); - if (val && PL_strcasestr(val, "no-cache")) { - LOG(("Not using the cached version becuz of 'pragma: no-cache'\n")); - // if this entry has to be validated then per pragma no cache rules just mark it as doomed. - doValidation = PR_FALSE; - usableCacheEntry = PR_FALSE; - goto end; - } // Be optimistic: assume that we won't need to do validation mRequestHead.SetHeader(nsHttp::If_Modified_Since, nsnull); @@ -820,21 +798,7 @@ nsHttpChannel::CheckCache() } end: - // content is valid iff we have been asked to validate (with an original request - // from the client as rw - if (!mCheckForCacheReusability) - mCachedContentIsValid = !doValidation; - - // blow away the entry if its not to be reused - // usableCacheEntry = No Pragma: no-cache - if (mCheckForCacheReusability && (mCacheAccess & nsICache::ACCESS_READ) && !usableCacheEntry) - { - CloseCacheEntry(NS_ERROR_ABORT); - PRBool delayed = PR_FALSE; - mCacheAccess |= nsICache::ACCESS_WRITE; // so that we can modify it. - OpenCacheEntry(&delayed); //ignored really - return NS_OK; - } + mCachedContentIsValid = !doValidation; if (doValidation) { const char *val; @@ -913,8 +877,7 @@ nsHttpChannel::CloseCacheEntry(nsresult status) if (mCacheEntry) { LOG(("nsHttpChannel::CloseCacheEntry [this=%x status=%x]", this, status)); - // we should be able to doom even if we don't have write access... - if (NS_FAILED(status) /*&& (mCacheAccess & nsICache::ACCESS_WRITE) */) { + if (NS_FAILED(status) && (mCacheAccess & nsICache::ACCESS_WRITE)) { LOG(("dooming cache entry!!")); rv = mCacheEntry->Doom(); } @@ -957,21 +920,12 @@ nsHttpChannel::InitCacheEntry() // The no-store directive within the 'Cache-Control:' header indicates // that we should not store the response in a persistent cache - // and so does the no-cache val = mResponseHead->PeekHeader(nsHttp::Cache_Control); - if (val && (PL_strcasestr(val, "no-store") || - PL_strcasestr(val, "no-cache"))) { + if (val && PL_strcasestr(val, "no-store")) { mLoadFlags |= INHIBIT_PERSISTENT_CACHING; LOG(("Inhibiting persistent caching because of \"%s\"\n", val)); } - // also do the same for pragma: no-cache... - val = mResponseHead->PeekHeader(nsHttp::Pragma); - if (val && PL_strcasestr(val, "no-cache")) { - mLoadFlags |= INHIBIT_PERSISTENT_CACHING; - LOG(("Inhibiting persistent caching because of Pragma:no-cache\n")); - } - // Store secure data in memory only if (mSecurityInfo) mCacheEntry->SetSecurityInfo(mSecurityInfo); @@ -2062,38 +2016,6 @@ nsHttpChannel::SetResponseHeader(const char *header, const char *value) return rv; } -NS_IMETHODIMP -nsHttpChannel::SetEquivHeader(const char *header, const char *value) -{ - NS_ASSERTION(mResponseHead, "Can't call SetEquivHeader this early!"); - if (!mResponseHead) - return NS_ERROR_NOT_AVAILABLE; - NS_ENSURE_ARG_POINTER(header && value); - - // cacheentry should be there... - NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_UNEXPECTED); - - // since we already have sent the headers notifications (OnExamineResponse) - // and to play it safe we would only accept a handful of headers here. - nsHttpAtom atom = nsHttp::ResolveAtom(header); - if (!atom) - return NS_ERROR_NOT_AVAILABLE; - - if (atom == nsHttp::Pragma || atom == nsHttp::Cache_Control) { - // Store the additional header - (void)mResponseHead->SetHeader(atom, value); - // We need to update the metadata associated with the cacheentry - nsCAutoString head; - mResponseHead->Flatten(head, PR_TRUE); - return mCacheEntry->SetMetaDataElement("response-head", head.get()); - } - -#if defined(DEBUG_gagan) || defined(DEBUG_darin) - else NS_ASSERTION(0, "nsHttpChannel::SetEquivHeader called with an unhandled header!"); -#endif - return NS_OK; // silently ignore the rest... -} - NS_IMETHODIMP nsHttpChannel::VisitResponseHeaders(nsIHttpHeaderVisitor *visitor) { diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.h b/mozilla/netwerk/protocol/http/src/nsHttpChannel.h index db7cf9a488f..4e98fbeed71 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.h +++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.h @@ -151,7 +151,6 @@ private: PRPackedBool mTriedCredentialsFromPrehost; PRPackedBool mFromCacheOnly; PRPackedBool mCachedContentIsValid; - PRPackedBool mCheckForCacheReusability; }; #endif diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp index fffe27704f7..e3f98afdd7f 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp @@ -1565,6 +1565,7 @@ nsHttpHandler::NewChannel(nsIURI *uri, nsIChannel **result) } rv = NewProxyChannel(uri, + nsnull, -1, nsnull, diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHeaderArray.cpp b/mozilla/netwerk/protocol/http/src/nsHttpHeaderArray.cpp index 078efd79b5c..fcfe82ae3cc 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpHeaderArray.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpHeaderArray.cpp @@ -160,8 +160,6 @@ nsHttpHeaderArray::CanAppendToHeader(nsHttpAtom header) header == nsHttp::Referer || header == nsHttp::Host || header == nsHttp::Authorization || - header == nsHttp::Pragma || - header == nsHttp::Cache_Control || header == nsHttp::Proxy_Authorization || header == nsHttp::If_Modified_Since || header == nsHttp::If_Unmodified_Since || diff --git a/mozilla/parser/htmlparser/src/nsIParser.h b/mozilla/parser/htmlparser/src/nsIParser.h index d4321197080..e8dbfe8113d 100644 --- a/mozilla/parser/htmlparser/src/nsIParser.h +++ b/mozilla/parser/htmlparser/src/nsIParser.h @@ -58,7 +58,7 @@ class nsIRequestObserver; class nsIParserFilter; class nsString; class nsIURI; -class nsIChannel; + enum eParserCommands { eViewNormal, @@ -205,13 +205,6 @@ 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 diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index 9898a799f73..5d0653cf842 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -2884,23 +2884,6 @@ 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 = mParserContext->mRequest->QueryInterface(NS_GET_IID(nsIChannel), - (void**)aChannel); - } - return result; -} - /** * Get the DTD associated with this parser * @update vidur 9/29/99 diff --git a/mozilla/parser/htmlparser/src/nsParser.h b/mozilla/parser/htmlparser/src/nsParser.h index 6c8f206a036..e96a83619b8 100644 --- a/mozilla/parser/htmlparser/src/nsParser.h +++ b/mozilla/parser/htmlparser/src/nsParser.h @@ -289,14 +289,6 @@ 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