Attachment #560670: patch 1 for bug #255119

View | Details | Raw Unified | Return to bug 255119
Collapse All | Expand All

(-)a/netwerk/protocol/http/nsHttpChannel.cpp (+11 lines)
Line     Link Here 
 Lines 61-76    Link Here 
61
#include "nsEscape.h"
61
#include "nsEscape.h"
62
#include "nsStreamUtils.h"
62
#include "nsStreamUtils.h"
63
#include "nsIOService.h"
63
#include "nsIOService.h"
64
#include "nsICacheService.h"
64
#include "nsICacheService.h"
65
#include "nsDNSPrefetch.h"
65
#include "nsDNSPrefetch.h"
66
#include "nsChannelClassifier.h"
66
#include "nsChannelClassifier.h"
67
#include "nsIRedirectResultListener.h"
67
#include "nsIRedirectResultListener.h"
68
#include "mozilla/TimeStamp.h"
68
#include "mozilla/TimeStamp.h"
69
#include "nsDOMError.h"
69
70
70
// True if the local cache should be bypassed when processing a request.
71
// True if the local cache should be bypassed when processing a request.
71
#define BYPASS_LOCAL_CACHE(loadFlags) \
72
#define BYPASS_LOCAL_CACHE(loadFlags) \
72
        (loadFlags & (nsIRequest::LOAD_BYPASS_CACHE | \
73
        (loadFlags & (nsIRequest::LOAD_BYPASS_CACHE | \
73
                      nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE))
74
                      nsICachingChannel::LOAD_BYPASS_LOCAL_CACHE))
74
75
75
static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID);
76
static NS_DEFINE_CID(kStreamListenerTeeCID, NS_STREAMLISTENERTEE_CID);
76
77
 Lines 1061-1076   nsHttpChannel::ProcessResponse() Link Here 
1061
    }
1062
    }
1062
1063
1063
    return rv;
1064
    return rv;
1064
}
1065
}
1065
1066
1066
nsresult
1067
nsresult
1067
nsHttpChannel::ContinueProcessResponse(nsresult rv)
1068
nsHttpChannel::ContinueProcessResponse(nsresult rv)
1068
{
1069
{
1070
    if (rv == NS_ERROR_DOM_BAD_URI) {
1071
        // The redirect was canceled for a malformed URI problem - which is
1072
        // likely an attempt to subvert the HTTP stack by redirecting to another
1073
        // scheme (e.g. javascript: ).
1074
        // In that case we want to throw an error instead of displaying the
1075
        // non-redirected response body.
1076
1077
        return NS_ERROR_CORRUPTED_CONTENT;
1078
    }
1079
1069
    if (NS_SUCCEEDED(rv)) {
1080
    if (NS_SUCCEEDED(rv)) {
1070
        InitCacheEntry();
1081
        InitCacheEntry();
1071
        CloseCacheEntry(PR_FALSE);
1082
        CloseCacheEntry(PR_FALSE);
1072
1083
1073
        if (mCacheForOfflineUse) {
1084
        if (mCacheForOfflineUse) {
1074
            // Store response in the offline cache
1085
            // Store response in the offline cache
1075
            InitOfflineCacheEntry();
1086
            InitOfflineCacheEntry();
1076
            CloseOfflineCacheEntry();
1087
            CloseOfflineCacheEntry();

Return to bug 255119