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

This commit is contained in:
peterv%propagandism.org 2006-05-05 11:48:07 +00:00
Родитель 110c37486d
Коммит a367cb9457
3 изменённых файлов: 13 добавлений и 18 удалений

Просмотреть файл

@ -215,6 +215,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;
@ -278,6 +284,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

Просмотреть файл

@ -109,11 +109,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 =
@ -124,15 +119,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;

Просмотреть файл

@ -766,10 +766,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);
}