From e46fcd4c73d494b6c128c39362f096943d7cbee0 Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Wed, 25 Jan 2006 00:48:40 +0000 Subject: [PATCH] fixes bug 323852 "redirect after a prefetch does not include X-moz: prefetch header" r=biesi sr=bzbarsky --- uriloader/prefetch/nsPrefetchService.cpp | 8 ++++++++ uriloader/prefetch/nsPrefetchService.h | 1 + 2 files changed, 9 insertions(+) diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index a299e987d12..ccd6262db0a 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -237,6 +237,14 @@ nsPrefetchListener::OnChannelRedirect(nsIChannel *aOldChannel, return NS_ERROR_ABORT; } + // HTTP request headers are not automatically forwarded to the new channel. + nsCOMPtr httpChannel = do_QueryInterface(aNewChannel); + NS_ENSURE_STATE(httpChannel); + + httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("X-Moz"), + NS_LITERAL_CSTRING("prefetch"), PR_FALSE); + + mService->UpdateCurrentChannel(aNewChannel); return NS_OK; } diff --git a/uriloader/prefetch/nsPrefetchService.h b/uriloader/prefetch/nsPrefetchService.h index 41e54fd9f11..956a3921521 100644 --- a/uriloader/prefetch/nsPrefetchService.h +++ b/uriloader/prefetch/nsPrefetchService.h @@ -73,6 +73,7 @@ public: nsresult Init(); void ProcessNextURI(); + void UpdateCurrentChannel(nsIChannel *c) { mCurrentChannel = c; } private: ~nsPrefetchService();