Fix for bug 334179 (XSLT document() function doesn't follow HTTP 301 / 302 responses). r=sicking, sr/a=bz.

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@196668 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterv%propagandism.org
2006-05-16 13:10:35 +00:00
parent f2bb61bb16
commit 3e99a16614
3 changed files with 13 additions and 18 deletions

View File

@@ -325,6 +325,12 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
nsresult rv = NS_OK;
mChannel = aChannel;
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(mChannel);
if (http) {
http->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
NS_LITERAL_CSTRING("text/xml,application/xml,application/xhtml+xml,*/*;q=0.1"),
PR_FALSE);
}
if (aLoaderURI) {
nsCOMPtr<nsIURI> docURI;
@@ -388,6 +394,12 @@ nsSyncLoader::LoadDocument(nsIChannel* aChannel,
rv = PushAsyncStream(listener);
}
http = do_QueryInterface(mChannel);
if (mLoadSuccess && http) {
PRBool succeeded;
mLoadSuccess = NS_SUCCEEDED(http->GetRequestSucceeded(&succeeded)) &&
succeeded;
}
mChannel = nsnull;
// This will release the proxy. Don't use the errorvalue from this since

View File

@@ -108,11 +108,6 @@ txParseDocumentFromURI(const nsAString& aHref, const txXPathNode& aLoader,
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(channel);
if (http) {
http->SetReferrer(loaderUri);
http->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
NS_LITERAL_CSTRING("text/xml,application/xml,application/xhtml+xml,*/*;q=0.1"),
PR_FALSE);
}
nsCOMPtr<nsISyncLoadDOMService> loader =
@@ -123,15 +118,7 @@ txParseDocumentFromURI(const nsAString& aHref, const txXPathNode& aLoader,
// the document.
nsIDOMDocument* theDocument = nsnull;
rv = loader->LoadDocumentAsXML(channel, loaderUri, &theDocument);
PRBool succeeded = NS_SUCCEEDED(rv) && theDocument;
if (succeeded && http) {
PRBool httpSucceeded;
rv = http->GetRequestSucceeded(&httpSucceeded);
succeeded = NS_SUCCEEDED(rv) && httpSucceeded;
}
if (!succeeded) {
if (NS_FAILED(rv)) {
aErrMsg.Append(NS_LITERAL_STRING("Document load of ") +
aHref + NS_LITERAL_STRING(" failed."));
return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;

View File

@@ -762,10 +762,6 @@ txSyncCompileObserver::loadURI(const nsAString& aUri,
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
if (httpChannel) {
httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
NS_LITERAL_CSTRING("text/xml,application/xml,application/xhtml+xml,*/*;q=0.1"),
PR_FALSE);
httpChannel->SetReferrer(referrerUri);
}