Ticket #3455: 0001-Bug-3455.1-Allow-proxy-settings-to-be-set-per-URL-ba.patch

File 0001-Bug-3455.1-Allow-proxy-settings-to-be-set-per-URL-ba.patch, 44.5 KB (added by arthuredelstein, 5 years ago)

ESR31.1.1-based 3455.1

  • dom/plugins/base/moz.build

    From 2bcdf4b5900fbeb8c8648586c9b8b3118eeaa809 Mon Sep 17 00:00:00 2001
    From: Arthur Edelstein <arthuredelstein@gmail.com>
    Date: Tue, 21 Oct 2014 02:15:25 -0700
    Subject: [PATCH 1/2] Bug #3455.1: Allow proxy settings to be set per URL bar
     domain.
    
    ---
     dom/plugins/base/moz.build                         |   1 +
     dom/plugins/base/nsPluginHost.cpp                  |  27 ++--
     netwerk/base/public/nsIProtocolProxyCallback.idl   |  10 +-
     netwerk/base/public/nsIProtocolProxyFilter.idl     |  34 ++++-
     netwerk/base/public/nsIProtocolProxyService.idl    |  32 ++++-
     netwerk/base/public/nsIProtocolProxyService2.idl   |  13 +-
     netwerk/base/src/nsIOService.cpp                   |  18 ++-
     netwerk/base/src/nsPACMan.cpp                      |   9 +-
     netwerk/base/src/nsPACMan.h                        |  10 +-
     netwerk/base/src/nsProtocolProxyService.cpp        | 157 ++++++++++++++-------
     netwerk/base/src/nsProtocolProxyService.h          |  49 +++++--
     netwerk/protocol/ftp/nsFtpConnectionThread.cpp     |  11 +-
     netwerk/protocol/http/HttpBaseChannel.cpp          |  10 ++
     netwerk/protocol/http/HttpBaseChannel.h            |   1 +
     netwerk/protocol/http/nsHttpChannel.cpp            |   6 +-
     netwerk/protocol/http/nsIHttpChannel.idl           |   6 +
     .../protocol/viewsource/nsViewSourceChannel.cpp    |   6 +
     netwerk/protocol/websocket/WebSocketChannel.cpp    |   4 +-
     18 files changed, 281 insertions(+), 123 deletions(-)
    
    diff --git a/dom/plugins/base/moz.build b/dom/plugins/base/moz.build
    index ded5fb5..25bae79 100644
    a b LOCAL_INCLUDES += [ 
    103103    '/gfx/skia/include/core',
    104104    '/layout/generic',
    105105    '/layout/xul',
     106    '/netwerk/base/src',
    106107    '/widget/android',
    107108    '/widget/xpwidgets',
    108109    '/xpcom/base',
  • dom/plugins/base/nsPluginHost.cpp

    diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp
    index bc6bf72..1efe59f 100644
    a b  
    3030#include "nsIURL.h"
    3131#include "nsTArray.h"
    3232#include "nsReadableUtils.h"
    33 #include "nsIProtocolProxyService2.h"
     33#include "nsProtocolProxyService.h"
    3434#include "nsIStreamConverterService.h"
    3535#include "nsIFile.h"
    3636#if defined(XP_MACOSX)
    nsresult nsPluginHost::FindProxyForURL(const char* url, char* *result) 
    583583  }
    584584  nsresult res;
    585585
    586   nsCOMPtr<nsIURI> uriIn;
    587   nsCOMPtr<nsIProtocolProxyService> proxyService;
    588   nsCOMPtr<nsIProtocolProxyService2> proxyService2;
    589   nsCOMPtr<nsIIOService> ioService;
    590 
    591   proxyService = do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &res);
     586  nsCOMPtr<nsIProtocolProxyService> proxyService =
     587    do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &res);
    592588  if (NS_FAILED(res) || !proxyService)
    593589    return res;
    594590
    595   proxyService2 = do_QueryInterface(proxyService, &res);
    596   if (NS_FAILED(res) || !proxyService2)
    597     return res;
     591  nsRefPtr<nsProtocolProxyService> rawProxyService = do_QueryObject(proxyService);
     592  if (!rawProxyService)
     593    return NS_ERROR_FAILURE;
    598594
    599   ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &res);
     595  nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID, &res);
    600596  if (NS_FAILED(res) || !ioService)
    601597    return res;
    602598
    603   // make an nsURI from the argument url
    604   res = ioService->NewURI(nsDependentCString(url), nullptr, nullptr, getter_AddRefs(uriIn));
     599  // make a temporary channel from the argument url
     600  nsCOMPtr<nsIChannel> tempChannel;
     601  res = ioService->NewChannel(nsDependentCString(url), nullptr, nullptr, getter_AddRefs(tempChannel));
    605602  if (NS_FAILED(res))
    606603    return res;
    607604
    608605  nsCOMPtr<nsIProxyInfo> pi;
    609606
    610   // Remove this with bug 778201
    611   res = proxyService2->DeprecatedBlockingResolve(uriIn, 0, getter_AddRefs(pi));
     607  // Remove this deprecated call in the future (see Bug 778201):
     608  res = rawProxyService->DeprecatedBlockingResolve(tempChannel, 0, getter_AddRefs(pi));
    612609  if (NS_FAILED(res))
    613610    return res;
    614611
  • netwerk/base/public/nsIProtocolProxyCallback.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyCallback.idl b/netwerk/base/public/nsIProtocolProxyCallback.idl
    index ca1ab51..96c2181 100644
    a b  
    66
    77#include "nsISupports.idl"
    88
    9 interface nsIURI;
     9interface nsIChannel;
    1010interface nsIProxyInfo;
    1111interface nsICancelable;
    1212
    interface nsICancelable; 
    1414 * This interface serves as a closure for nsIProtocolProxyService's
    1515 * asyncResolve method.
    1616 */
    17 [scriptable, uuid(a9967200-f95e-45c2-beb3-9b060d874bfd)]
     17[scriptable, uuid(fbb6eff6-0cc2-4d99-8d6f-0a12b462bdeb)]
    1818interface nsIProtocolProxyCallback : nsISupports
    1919{
    2020  /**
    interface nsIProtocolProxyCallback : nsISupports 
    2323   *
    2424   * @param aRequest
    2525   *        The value returned from asyncResolve.
    26    * @param aURI
    27    *        The URI passed to asyncResolve.
     26   * @param aChannel
     27   *        The channel passed to asyncResolve.
    2828   * @param aProxyInfo
    2929   *        The resulting proxy info or null if there is no associated proxy
    3030   *        info for aURI.  As with the result of nsIProtocolProxyService's
    interface nsIProtocolProxyCallback : nsISupports 
    3636   *        indicates the reason for the failure and aProxyInfo will be null.
    3737   */
    3838  void onProxyAvailable(in nsICancelable aRequest,
    39                         in nsIURI aURI,
     39                        in nsIChannel aChannel,
    4040                        in nsIProxyInfo aProxyInfo,
    4141                        in nsresult aStatus);
    4242};
  • netwerk/base/public/nsIProtocolProxyFilter.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyFilter.idl b/netwerk/base/public/nsIProtocolProxyFilter.idl
    index 8ad6ca4..8798a49 100644
    a b  
    66
    77#include "nsISupports.idl"
    88
     9interface nsIChannel;
    910interface nsIProtocolProxyService;
    1011interface nsIProxyInfo;
    1112interface nsIURI;
    interface nsIURI; 
    1314/**
    1415 * This interface is used to apply filters to the proxies selected for a given
    1516 * URI.  Use nsIProtocolProxyService::registerFilter to hook up instances of
    16  * this interface.
     17 * this interface. See also nsIProtocolProxyChannelFilter.
    1718 */
    1819[scriptable, uuid(f424abd3-32b4-456c-9f45-b7e3376cb0d1)]
    1920interface nsIProtocolProxyFilter : nsISupports
    interface nsIProtocolProxyFilter : nsISupports 
    4041  nsIProxyInfo applyFilter(in nsIProtocolProxyService aProxyService,
    4142                           in nsIURI aURI, in nsIProxyInfo aProxy);
    4243};
     44
     45/**
     46 * This interface is used to apply filters to the proxies selected for a given
     47 * channel.  Use nsIProtocolProxyService::registerChannelFilter to hook up instances of
     48 * this interface. See also nsIProtocolProxyFilter.
     49 */
     50[scriptable, uuid(245b0880-82c5-4e6e-be6d-bc586aa55a90)]
     51interface nsIProtocolProxyChannelFilter : nsISupports
     52{
     53  /**
     54   * This method is called to apply proxy filter rules for the given channel
     55   * and proxy object (or list of proxy objects).
     56   *
     57   * @param aProxyService
     58   *        A reference to the Protocol Proxy Service.  This is passed so that
     59   *        implementations may easily access methods such as newProxyInfo.
     60   * @param aChannel
     61   *        The channel for which these proxy settings apply.
     62   * @param aProxy
     63   *        The proxy (or list of proxies) that would be used by default for
     64   *        the given channel. This may be null.
     65   *
     66   * @return The proxy (or list of proxies) that should be used in place of
     67   *         aProxy. This can be just be aProxy if the filter chooses not to
     68   *         modify the proxy. It can also be null to indicate that a direct
     69   *         connection should be used.  Use aProxyService.newProxyInfo to
     70   *         construct nsIProxyInfo objects.
     71   */
     72  nsIProxyInfo applyFilter(in nsIProtocolProxyService aProxyService,
     73                           in nsIChannel aChannel, in nsIProxyInfo aProxy);
     74};
  • netwerk/base/public/nsIProtocolProxyService.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyService.idl b/netwerk/base/public/nsIProtocolProxyService.idl
    index 526eab8..9365658 100644
    a b  
    99interface nsICancelable;
    1010interface nsIProtocolProxyCallback;
    1111interface nsIProtocolProxyFilter;
     12interface nsIProtocolProxyChannelFilter;
    1213interface nsIProxyInfo;
    1314interface nsIChannel;
    1415interface nsIURI;
    interface nsIURI; 
    1718 * nsIProtocolProxyService provides methods to access information about
    1819 * various network proxies.
    1920 */
    20 [scriptable, uuid(e77c642b-026f-41ce-9b23-f829a6e3f300)]
     21[scriptable, uuid(ab363090-c331-489f-aabb-7fe4481795b8)]
    2122interface nsIProtocolProxyService : nsISupports
    2223{
    2324    /** Flag 1 << 0 is unused **/
    interface nsIProtocolProxyService : nsISupports 
    6465
    6566    /**
    6667     * This method returns via callback a nsIProxyInfo instance that identifies
    67      * a proxy to be used for loading the given URI.  Otherwise, this method returns
     68     * a proxy to be used for the given channel.  Otherwise, this method returns
    6869     * null indicating that a direct connection should be used.
    6970     *
    70      * @param aURI
    71      *        The URI to test.
     71     * @param aChannel
     72     *        The channel for which a proxy is to be found.
    7273     * @param aFlags
    7374     *        A bit-wise combination of the RESOLVE_ flags defined above.  Pass
    7475     *        0 to specify the default behavior.  Any additional bits that do
    interface nsIProtocolProxyService : nsISupports 
    9495     *
    9596     * @see nsIProxiedProtocolHandler::newProxiedChannel
    9697     */
    97     nsICancelable asyncResolve(in nsIURI aURI, in unsigned long aFlags,
     98    nsICancelable asyncResolve(in nsIChannel aChannel, in unsigned long aFlags,
    9899                               in nsIProtocolProxyCallback aCallback);
    99100
    100101    /**
    interface nsIProtocolProxyService : nsISupports 
    191192                        in unsigned long aPosition);
    192193
    193194    /**
     195     * Similar to registerFilter, but accepts an nsIProtocolProxyChannelFilter,
     196     * which selects proxies according to channel rather than URI.
     197     *
     198     * @param aFilter
     199     *        The nsIProtocolProxyChannelFilter instance to be registered.
     200     * @param aPosition
     201     *        The position of the filter.
     202     */
     203    void registerChannelFilter(in nsIProtocolProxyChannelFilter aFilter,
     204                               in unsigned long aPosition);
     205
     206    /**
    194207     * This method may be used to unregister a proxy filter instance.  All
    195208     * filters will be automatically unregistered at XPCOM shutdown.
    196209     *
    interface nsIProtocolProxyService : nsISupports 
    199212     */
    200213    void unregisterFilter(in nsIProtocolProxyFilter aFilter);
    201214
     215    /**
     216     * This method may be used to unregister a proxy channel filter instance.  All
     217     * filters will be automatically unregistered at XPCOM shutdown.
     218     *
     219     * @param aFilter
     220     *        The nsIProtocolProxyChannelFilter instance to be unregistered.
     221     */
     222    void unregisterChannelFilter(in nsIProtocolProxyChannelFilter aFilter);
     223
    202224     /**
    203225      * These values correspond to the possible integer values for the
    204226      * network.proxy.type preference.
  • netwerk/base/public/nsIProtocolProxyService2.idl

    diff --git a/netwerk/base/public/nsIProtocolProxyService2.idl b/netwerk/base/public/nsIProtocolProxyService2.idl
    index cb39a33..9e4f548 100644
    a b  
    99/**
    1010 * An extension of nsIProtocolProxyService
    1111 */
    12 [scriptable, uuid(bb52e571-4a0e-4363-83d0-52034910dd14)]
     12[scriptable, uuid(b2e5b2c0-e21e-4845-b336-be6d60a38951)]
    1313interface nsIProtocolProxyService2 : nsIProtocolProxyService
    1414{
    1515  /**
    interface nsIProtocolProxyService2 : nsIProtocolProxyService 
    1818   */
    1919  void reloadPAC();
    2020
    21   /**
    22    * This exists so Java(tm) can migrate to an asynchronous interface.
    23    * Do not use this unless you are the plugin interface, and even then you
    24    * ought to feel horribly guilty because you will create main thread jank.
    25    *
    26    * No documentation - it is deprecated!
    27    **/
    28   nsIProxyInfo deprecatedBlockingResolve(in nsIURI aURI, in unsigned long aFlags);
    29 
    3021    /**
    3122     * This method is identical to asyncResolve() except it may execute the
    3223     * callback function immediately (i.e from the stack of asyncResolve2()) if
    3324     * it is immediately ready to run. The nsICancelable return value will be
    3425     * null in that case.
    3526     */
    36   nsICancelable asyncResolve2(in nsIURI aURI, in unsigned long aFlags,
     27  nsICancelable asyncResolve2(in nsIChannel aChannel, in unsigned long aFlags,
    3728                              in nsIProtocolProxyCallback aCallback);
    3829};
  • netwerk/base/src/nsIOService.cpp

    diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp
    index b64e7d3..99efa57 100644
    a b private: 
    11971197NS_IMPL_ISUPPORTS(IOServiceProxyCallback, nsIProtocolProxyCallback)
    11981198
    11991199NS_IMETHODIMP
    1200 IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIURI *aURI,
     1200IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIChannel *channel,
    12011201                                         nsIProxyInfo *pi, nsresult status)
    12021202{
    12031203    // Checking proxy status for speculative connect
    IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIURI *aURI, 
    12091209        return NS_OK;
    12101210    }
    12111211
     1212    nsCOMPtr<nsIURI> uri;
     1213    nsresult rv = channel->GetURI(getter_AddRefs(uri));
     1214    if (NS_FAILED(rv))
     1215        return NS_OK;
     1216
    12121217    nsAutoCString scheme;
    1213     nsresult rv = aURI->GetScheme(scheme);
     1218    rv = uri->GetScheme(scheme);
    12141219    if (NS_FAILED(rv))
    12151220        return NS_OK;
    12161221
    IOServiceProxyCallback::OnProxyAvailable(nsICancelable *request, nsIURI *aURI, 
    12251230    if (!speculativeHandler)
    12261231        return NS_OK;
    12271232
    1228     speculativeHandler->SpeculativeConnect(aURI,
     1233    speculativeHandler->SpeculativeConnect(uri,
    12291234                                           mCallbacks);
    12301235    return NS_OK;
    12311236}
    nsIOService::SpeculativeConnect(nsIURI *aURI, 
    12431248    if (NS_FAILED(rv))
    12441249        return rv;
    12451250
     1251    nsCOMPtr<nsIChannel> channel;
     1252    rv = NewChannelFromURI(aURI, getter_AddRefs(channel));
     1253    if (NS_FAILED(rv))
     1254        return rv;
     1255
    12461256    nsCOMPtr<nsICancelable> cancelable;
    12471257    nsRefPtr<IOServiceProxyCallback> callback =
    12481258        new IOServiceProxyCallback(aCallbacks, this);
    1249     return pps->AsyncResolve(aURI, 0, callback, getter_AddRefs(cancelable));
     1259    return pps->AsyncResolve(channel, 0, callback, getter_AddRefs(cancelable));
    12501260}
  • netwerk/base/src/nsPACMan.cpp

    diff --git a/netwerk/base/src/nsPACMan.cpp b/netwerk/base/src/nsPACMan.cpp
    index 81bc17e..e8b0b2d 100644
    a b nsPACMan::Shutdown() 
    320320}
    321321
    322322nsresult
    323 nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback,
    324                               bool mainThreadResponse)
     323nsPACMan::AsyncGetProxyForChannel(nsIChannel *channel, nsPACManCallback *callback,
     324                                  bool mainThreadResponse)
    325325{
    326326  NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread");
    327327  if (mShutdown)
    nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback, 
    332332      TimeStamp::Now() > mScheduledReload)
    333333    LoadPACFromURI(EmptyCString());
    334334
     335  nsCOMPtr<nsIURI> uri;
     336  nsresult rv = channel->GetURI(getter_AddRefs(uri));
     337  if (NS_FAILED(rv))
     338    return rv;
     339
    335340  nsRefPtr<PendingPACQuery> query =
    336341    new PendingPACQuery(this, uri, callback, mainThreadResponse);
    337342
  • netwerk/base/src/nsPACMan.h

    diff --git a/netwerk/base/src/nsPACMan.h b/netwerk/base/src/nsPACMan.h
    index 410ae5641..6f95d97 100644
    a b class nsIThread; 
    2727class WaitForThreadShutdown;
    2828
    2929/**
    30  * This class defines a callback interface used by AsyncGetProxyForURI.
     30 * This class defines a callback interface used by AsyncGetProxyForChannel.
    3131 */
    3232class NS_NO_VTABLE nsPACManCallback : public nsISupports
    3333{
    3434public:
    3535  /**
    36    * This method is invoked on the same thread that called AsyncGetProxyForURI.
     36   * This method is invoked on the same thread that called AsyncGetProxyForChannel.
    3737   *
    3838   * @param status
    3939   *        This parameter indicates whether or not the PAC query succeeded.
    public: 
    101101   * will queue up the request, and complete it once the PAC file has been
    102102   * loaded.
    103103   *
    104    * @param uri
    105    *        The URI to query.
     104   * @param channel
     105   *        The channel to query.
    106106   * @param callback
    107107   *        The callback to run once the PAC result is available.
    108108   * @param mustCallbackOnMainThread
    109109   *        If set to false the callback can be made from the PAC thread
    110110   */
    111   nsresult AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback,
     111  nsresult AsyncGetProxyForChannel(nsIChannel *channel, nsPACManCallback *callback,
    112112                               bool mustCallbackOnMainThread);
    113113
    114114  /**
  • netwerk/base/src/nsProtocolProxyService.cpp

    diff --git a/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp
    index 98ea68b..3878c58d 100644
    a b  
    1414#include "nsIObserverService.h"
    1515#include "nsIProtocolHandler.h"
    1616#include "nsIProtocolProxyCallback.h"
     17#include "nsIChannel.h"
    1718#include "nsICancelable.h"
    1819#include "nsIDNSService.h"
    1920#include "nsPIDNSService.h"
    struct nsProtocolInfo { 
    6768//----------------------------------------------------------------------------
    6869
    6970// The nsPACManCallback portion of this implementation should be run
    70 // on the main thread - so call nsPACMan::AsyncGetProxyForURI() with
     71// on the main thread - so call nsPACMan::AsyncGetProxyForChannel() with
    7172// a true mainThreadResponse parameter.
    7273class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable
    7374                                      , public nsPACManCallback
    class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable 
    7677public:
    7778    NS_DECL_THREADSAFE_ISUPPORTS
    7879
    79     nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIURI *uri,
     80    nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIChannel *channel,
    8081                          uint32_t aResolveFlags,
    8182                          nsIProtocolProxyCallback *callback)
    8283        : mStatus(NS_OK)
    public: 
    8485        , mResolveFlags(aResolveFlags)
    8586        , mPPS(pps)
    8687        , mXPComPPS(pps)
    87         , mURI(uri)
     88        , mChannel(channel)
    8889        , mCallback(callback)
    8990    {
    9091        NS_ASSERTION(mCallback, "null callback");
    public: 
    100101            nsCOMPtr<nsIThread> mainThread;
    101102            NS_GetMainThread(getter_AddRefs(mainThread));
    102103
    103             if (mURI) {
    104                 nsIURI *forgettable;
    105                 mURI.forget(&forgettable);
     104            if (mChannel) {
     105                nsIChannel *forgettable;
     106                mChannel.forget(&forgettable);
    106107                NS_ProxyRelease(mainThread, forgettable, false);
    107108            }
    108109
    private: 
    207208        if (NS_SUCCEEDED(mStatus) && !mProxyInfo && !mPACString.IsEmpty()) {
    208209            mPPS->ProcessPACString(mPACString, mResolveFlags,
    209210                                   getter_AddRefs(mProxyInfo));
     211            nsCOMPtr<nsIURI> uri;
     212            mChannel->GetURI(getter_AddRefs(uri));
    210213
    211214            // Now apply proxy filters
    212215            nsProtocolInfo info;
    213             mStatus = mPPS->GetProtocolInfo(mURI, &info);
     216            mStatus = mPPS->GetProtocolInfo(uri, &info);
    214217            if (NS_SUCCEEDED(mStatus))
    215                 mPPS->ApplyFilters(mURI, info, mProxyInfo);
     218                mPPS->ApplyFilters(mChannel, info, mProxyInfo);
    216219            else
    217220                mProxyInfo = nullptr;
    218221
    219222            LOG(("pac thread callback %s\n", mPACString.get()));
    220223            if (NS_SUCCEEDED(mStatus))
    221224                mPPS->MaybeDisableDNSPrefetch(mProxyInfo);
    222             mCallback->OnProxyAvailable(this, mURI, mProxyInfo, mStatus);
     225            mCallback->OnProxyAvailable(this, mChannel, mProxyInfo, mStatus);
    223226        }
    224227        else if (NS_SUCCEEDED(mStatus) && !mPACURL.IsEmpty()) {
    225228            LOG(("pac thread callback indicates new pac file load\n"));
    private: 
    229232            if (NS_SUCCEEDED(rv)) {
    230233                // now that the load is triggered, we can resubmit the query
    231234                nsRefPtr<nsAsyncResolveRequest> newRequest =
    232                     new nsAsyncResolveRequest(mPPS, mURI, mResolveFlags, mCallback);
    233                 rv = mPPS->mPACMan->AsyncGetProxyForURI(mURI, newRequest, true);
     235                    new nsAsyncResolveRequest(mPPS, mChannel, mResolveFlags, mCallback);
     236                rv = mPPS->mPACMan->AsyncGetProxyForChannel(mChannel, newRequest, true);
    234237            }
    235238
    236239            if (NS_FAILED(rv))
    237                 mCallback->OnProxyAvailable(this, mURI, nullptr, rv);
     240                mCallback->OnProxyAvailable(this, mChannel, nullptr, rv);
    238241
    239242            // do not call onproxyavailable() in SUCCESS case - the newRequest will
    240243            // take care of that
    private: 
    243246            LOG(("pac thread callback did not provide information %X\n", mStatus));
    244247            if (NS_SUCCEEDED(mStatus))
    245248                mPPS->MaybeDisableDNSPrefetch(mProxyInfo);
    246             mCallback->OnProxyAvailable(this, mURI, mProxyInfo, mStatus);
     249            mCallback->OnProxyAvailable(this, mChannel, mProxyInfo, mStatus);
    247250        }
    248251
    249252        // We are on the main thread now and don't need these any more so
    private: 
    252255        mCallback = nullptr;  // in case the callback holds an owning ref to us
    253256        mPPS = nullptr;
    254257        mXPComPPS = nullptr;
    255         mURI = nullptr;
     258        mChannel = nullptr;
    256259        mProxyInfo = nullptr;
    257260    }
    258261
    private: 
    266269
    267270    nsProtocolProxyService            *mPPS;
    268271    nsCOMPtr<nsIProtocolProxyService>  mXPComPPS;
    269     nsCOMPtr<nsIURI>                   mURI;
     272    nsCOMPtr<nsIChannel>               mChannel;
    270273    nsCOMPtr<nsIProtocolProxyCallback> mCallback;
    271274    nsCOMPtr<nsIProxyInfo>             mProxyInfo;
    272275};
    nsProtocolProxyService::ReloadPAC() 
    964967// The nsPACManCallback portion of this implementation should be run
    965968// off the main thread, because it uses a condvar for signaling and
    966969// the main thread is blocking on that condvar -
    967 //  so call nsPACMan::AsyncGetProxyForURI() with
     970//  so call nsPACMan::AsyncGetProxyForChannel() with
    968971// a false mainThreadResponse parameter.
    969972class nsAsyncBridgeRequest MOZ_FINAL  : public nsPACManCallback
    970973{
    private: 
    10101013};
    10111014NS_IMPL_ISUPPORTS0(nsAsyncBridgeRequest)
    10121015
    1013 // nsIProtocolProxyService2
     1016// nsProtocolProxyService
    10141017NS_IMETHODIMP
    1015 nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI,
     1018nsProtocolProxyService::DeprecatedBlockingResolve(nsIChannel *aChannel,
    10161019                                                  uint32_t aFlags,
    10171020                                                  nsIProxyInfo **retval)
    10181021{
    1019     NS_ENSURE_ARG_POINTER(aURI);
     1022    NS_ENSURE_ARG_POINTER(aChannel);
     1023
     1024    nsCOMPtr<nsIURI> uri;
     1025    aChannel->GetURI(getter_AddRefs(uri));
    10201026
    10211027    nsProtocolInfo info;
    1022     nsresult rv = GetProtocolInfo(aURI, &info);
     1028    nsresult rv = GetProtocolInfo(uri, &info);
    10231029    if (NS_FAILED(rv))
    10241030        return rv;
    10251031
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10301036    // but if neither of them are in use, we can just do the work
    10311037    // right here and directly invoke the callback
    10321038
    1033     rv = Resolve_Internal(aURI, info, aFlags, &usePACThread, getter_AddRefs(pi));
     1039    rv = Resolve_Internal(aChannel, info, aFlags, &usePACThread, getter_AddRefs(pi));
    10341040    if (NS_FAILED(rv))
    10351041        return rv;
    10361042
    10371043    if (!usePACThread || !mPACMan) {
    1038         ApplyFilters(aURI, info, pi);
     1044        ApplyFilters(aChannel, info, pi);
    10391045        pi.forget(retval);
    10401046        return NS_OK;
    10411047    }
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10441050    // code, but block this thread on that completion.
    10451051    nsRefPtr<nsAsyncBridgeRequest> ctx = new nsAsyncBridgeRequest();
    10461052    ctx->Lock();
    1047     if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForURI(aURI, ctx, false))) {
     1053    if (NS_SUCCEEDED(mPACMan->AsyncGetProxyForChannel(aChannel, ctx, false))) {
    10481054        // this can really block the main thread, so cap it at 3 seconds
    10491055       ctx->Wait();
    10501056    }
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10601066    if (!ctx->mPACString.IsEmpty()) {
    10611067        LOG(("sync pac thread callback %s\n", ctx->mPACString.get()));
    10621068        ProcessPACString(ctx->mPACString, 0, getter_AddRefs(pi));
    1063         ApplyFilters(aURI, info, pi);
     1069        ApplyFilters(aChannel, info, pi);
    10641070        pi.forget(retval);
    10651071        return NS_OK;
    10661072    }
    nsProtocolProxyService::DeprecatedBlockingResolve(nsIURI *aURI, 
    10841090}
    10851091
    10861092nsresult
    1087 nsProtocolProxyService::AsyncResolveInternal(nsIURI *uri, uint32_t flags,
     1093nsProtocolProxyService::AsyncResolveInternal(nsIChannel *channel, uint32_t flags,
    10881094                                             nsIProtocolProxyCallback *callback,
    10891095                                             nsICancelable **result,
    10901096                                             bool isSyncOK)
    10911097{
    1092     NS_ENSURE_ARG_POINTER(uri);
     1098    NS_ENSURE_ARG_POINTER(channel);
    10931099    NS_ENSURE_ARG_POINTER(callback);
    10941100
     1101    nsCOMPtr<nsIURI> uri;
     1102    channel->GetURI(getter_AddRefs(uri));
     1103
    10951104    *result = nullptr;
    10961105    nsRefPtr<nsAsyncResolveRequest> ctx =
    1097         new nsAsyncResolveRequest(this, uri, flags, callback);
     1106        new nsAsyncResolveRequest(this, channel, flags, callback);
    10981107
    10991108    nsProtocolInfo info;
    11001109    nsresult rv = GetProtocolInfo(uri, &info);
    nsProtocolProxyService::AsyncResolveInternal(nsIURI *uri, uint32_t flags, 
    11081117    // but if neither of them are in use, we can just do the work
    11091118    // right here and directly invoke the callback
    11101119
    1111     rv = Resolve_Internal(uri, info, flags, &usePACThread, getter_AddRefs(pi));
     1120    rv = Resolve_Internal(channel, info, flags, &usePACThread, getter_AddRefs(pi));
    11121121    if (NS_FAILED(rv))
    11131122        return rv;
    11141123
    11151124    if (!usePACThread || !mPACMan) {
    11161125        // we can do it locally
    1117         ApplyFilters(uri, info, pi);
     1126        ApplyFilters(channel, info, pi);
    11181127        ctx->SetResult(NS_OK, pi);
    11191128        if (isSyncOK) {
    11201129            ctx->Run();
    nsProtocolProxyService::AsyncResolveInternal(nsIURI *uri, uint32_t flags, 
    11291138
    11301139    // else kick off a PAC thread query
    11311140
    1132     rv = mPACMan->AsyncGetProxyForURI(uri, ctx, true);
     1141    rv = mPACMan->AsyncGetProxyForChannel(channel, ctx, true);
    11331142    if (NS_SUCCEEDED(rv))
    11341143        ctx.forget(result);
    11351144    return rv;
    nsProtocolProxyService::AsyncResolveInternal(nsIURI *uri, uint32_t flags, 
    11371146
    11381147// nsIProtocolProxyService
    11391148NS_IMETHODIMP
    1140 nsProtocolProxyService::AsyncResolve2(nsIURI *uri, uint32_t flags,
     1149nsProtocolProxyService::AsyncResolve2(nsIChannel *channel, uint32_t flags,
    11411150                                      nsIProtocolProxyCallback *callback,
    11421151                                      nsICancelable **result)
    11431152{
    1144     return AsyncResolveInternal(uri, flags, callback, result, true);
     1153    return AsyncResolveInternal(channel, flags, callback, result, true);
    11451154}
    11461155
    11471156NS_IMETHODIMP
    1148 nsProtocolProxyService::AsyncResolve(nsIURI *uri, uint32_t flags,
     1157nsProtocolProxyService::AsyncResolve(nsIChannel *channel, uint32_t flags,
    11491158                                     nsIProtocolProxyCallback *callback,
    11501159                                     nsICancelable **result)
    11511160{
    1152     return AsyncResolveInternal(uri, flags, callback, result, false);
     1161    return AsyncResolveInternal(channel, flags, callback, result, false);
    11531162}
    11541163
    11551164NS_IMETHODIMP
    nsProtocolProxyService::GetFailoverForProxy(nsIProxyInfo *aProxy, 
    12211230    return NS_OK;
    12221231}
    12231232
    1224 NS_IMETHODIMP
    1225 nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *filter,
    1226                                        uint32_t position)
     1233nsresult
     1234nsProtocolProxyService::InsertFilterLink(FilterLink *link, uint32_t position)
    12271235{
    1228     UnregisterFilter(filter);  // remove this filter if we already have it
    1229 
    1230     FilterLink *link = new FilterLink(position, filter);
    1231     if (!link)
    1232         return NS_ERROR_OUT_OF_MEMORY;
    1233 
    12341236    if (!mFilters) {
    12351237        mFilters = link;
    12361238        return NS_OK;
    nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *filter, 
    12581260}
    12591261
    12601262NS_IMETHODIMP
    1261 nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *filter)
     1263nsProtocolProxyService::RegisterFilter(nsIProtocolProxyFilter *filter,
     1264                                       uint32_t position)
    12621265{
    1263     // QI to nsISupports so we can safely test object identity.
    1264     nsCOMPtr<nsISupports> givenObject = do_QueryInterface(filter);
     1266    UnregisterFilter(filter); // remove this filter if we already have it
     1267
     1268    FilterLink *link = new FilterLink(position, filter);
     1269    if (!link)
     1270        return NS_ERROR_OUT_OF_MEMORY;
     1271    return InsertFilterLink(link, position);
     1272}
    12651273
     1274NS_IMETHODIMP
     1275nsProtocolProxyService::RegisterChannelFilter(nsIProtocolProxyChannelFilter *channelFilter,
     1276                                              uint32_t position)
     1277{
     1278    UnregisterChannelFilter(channelFilter);  // remove this filter if we already have it
     1279
     1280    FilterLink *link = new FilterLink(position, channelFilter);
     1281    if (!link)
     1282        return NS_ERROR_OUT_OF_MEMORY;
     1283    return InsertFilterLink(link, position);
     1284}
     1285
     1286nsresult
     1287nsProtocolProxyService::RemoveFilterLink(nsISupports* givenObject)
     1288{
    12661289    FilterLink *last = nullptr;
    12671290    for (FilterLink *iter = mFilters; iter; iter = iter->next) {
    12681291        nsCOMPtr<nsISupports> object = do_QueryInterface(iter->filter);
    nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *filter) 
    12831306}
    12841307
    12851308NS_IMETHODIMP
     1309nsProtocolProxyService::UnregisterFilter(nsIProtocolProxyFilter *filter) {
     1310    // QI to nsISupports so we can safely test object identity.
     1311    nsCOMPtr<nsISupports> givenObject = do_QueryInterface(filter);
     1312    return RemoveFilterLink(givenObject);
     1313}
     1314
     1315NS_IMETHODIMP
     1316nsProtocolProxyService::UnregisterChannelFilter(nsIProtocolProxyChannelFilter *channelFilter) {
     1317    // QI to nsISupports so we can safely test object identity.
     1318    nsCOMPtr<nsISupports> givenObject = do_QueryInterface(channelFilter);
     1319    return RemoveFilterLink(givenObject);
     1320}
     1321
     1322NS_IMETHODIMP
    12861323nsProtocolProxyService::GetProxyConfigType(uint32_t* aProxyConfigType)
    12871324{
    12881325  *aProxyConfigType = mProxyConfig;
    nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, 
    14891526}
    14901527
    14911528nsresult
    1492 nsProtocolProxyService::Resolve_Internal(nsIURI *uri,
     1529nsProtocolProxyService::Resolve_Internal(nsIChannel *channel,
    14931530                                         const nsProtocolInfo &info,
    14941531                                         uint32_t flags,
    14951532                                         bool *usePACThread,
    14961533                                         nsIProxyInfo **result)
    14971534{
    1498     NS_ENSURE_ARG_POINTER(uri);
     1535    NS_ENSURE_ARG_POINTER(channel);
    14991536    nsresult rv = SetupPACThread();
    15001537    if (NS_FAILED(rv))
    15011538        return rv;
    nsProtocolProxyService::Resolve_Internal(nsIURI *uri, 
    15061543    if (!(info.flags & nsIProtocolHandler::ALLOWS_PROXY))
    15071544        return NS_OK;  // Can't proxy this (filters may not override)
    15081545
     1546    nsCOMPtr<nsIURI> uri;
     1547    channel->GetURI(getter_AddRefs(uri));
     1548
    15091549    // See bug #586908.
    15101550    // Avoid endless loop if |uri| is the current PAC-URI. Returning OK
    15111551    // here means that we will not use a proxy for this connection.
    nsProtocolProxyService::MaybeDisableDNSPrefetch(nsIProxyInfo *aProxy) 
    16751715}
    16761716
    16771717void
    1678 nsProtocolProxyService::ApplyFilters(nsIURI *uri, const nsProtocolInfo &info,
     1718nsProtocolProxyService::ApplyFilters(nsIChannel *channel, const nsProtocolInfo &info,
    16791719                                     nsIProxyInfo **list)
    16801720{
    16811721    if (!(info.flags & nsIProtocolHandler::ALLOWS_PROXY))
    nsProtocolProxyService::ApplyFilters(nsIURI *uri, const nsProtocolInfo &info, 
    16901730
    16911731    for (FilterLink *iter = mFilters; iter; iter = iter->next) {
    16921732        PruneProxyInfo(info, list);
    1693 
    1694         rv = iter->filter->ApplyFilter(this, uri, *list,
    1695                                        getter_AddRefs(result));
     1733        if (!!iter->filter) {
     1734          nsCOMPtr<nsIURI> uri;
     1735          channel->GetURI(getter_AddRefs(uri));
     1736          if (!!uri) {
     1737            nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);
     1738            nsCOMPtr<nsIURI> proxyURI = nullptr;
     1739            if (!!httpChannel) {
     1740              httpChannel->GetProxyURI(getter_AddRefs(proxyURI));
     1741            }
     1742            rv = iter->filter->ApplyFilter(this, proxyURI ? proxyURI : uri, *list,
     1743                                           getter_AddRefs(result));
     1744          }
     1745        } else if (!!iter->channelFilter) {
     1746          rv = iter->channelFilter->ApplyFilter(this, channel, *list,
     1747                                                getter_AddRefs(result));
     1748        }
    16961749        if (NS_FAILED(rv))
    16971750            continue;
    16981751        result.swap(*list);
  • netwerk/base/src/nsProtocolProxyService.h

    diff --git a/netwerk/base/src/nsProtocolProxyService.h b/netwerk/base/src/nsProtocolProxyService.h
    index 4108e30..9ef68b9 100644
    a b class nsIPrefBranch; 
    2727class nsISystemProxySettings;
    2828class nsPACMan;
    2929
     30// CID for the nsProtocolProxyService class
     31// 091eedd8-8bae-4fe3-ad62-0c87351e640d
     32#define NS_PROTOCOL_PROXY_SERVICE_IMPL_CID        \
     33{ 0x091eedd8, 0x8bae, 0x4fe3, \
     34        { 0xad, 0x62, 0x0c, 0x87, 0x35, 0x1e, 0x64, 0x0d } }
     35
    3036class nsProtocolProxyService MOZ_FINAL : public nsIProtocolProxyService2
    3137                                       , public nsIObserver
    3238{
    public: 
    3642    NS_DECL_NSIPROTOCOLPROXYSERVICE
    3743    NS_DECL_NSIOBSERVER
    3844
     45    NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROTOCOL_PROXY_SERVICE_IMPL_CID)
     46
    3947    nsProtocolProxyService() NS_HIDDEN;
    4048
    4149    NS_HIDDEN_(nsresult) Init();
     50    nsresult DeprecatedBlockingResolve(nsIChannel *aChannel,
     51                                       uint32_t aFlags,
     52                                       nsIProxyInfo **retval);
    4253
    4354protected:
    4455    friend class nsAsyncResolveRequest;
    protected: 
    192203     * caller with either the proxy info result or a flag to instruct the
    193204     * caller to use PAC instead.
    194205     *
    195      * @param uri
    196      *        The URI to test.
     206     * @param channel
     207     *        The channel to test.
    197208     * @param info
    198209     *        Information about the URI's protocol.
    199210     * @param flags
    protected: 
    204215     * @param result
    205216     *        The resulting proxy info or null.
    206217     */
    207     NS_HIDDEN_(nsresult) Resolve_Internal(nsIURI *uri,
     218    NS_HIDDEN_(nsresult) Resolve_Internal(nsIChannel *channel,
    208219                                          const nsProtocolInfo &info,
    209220                                          uint32_t flags,
    210221                                          bool *usePAC,
    protected: 
    214225     * This method applies the registered filters to the given proxy info
    215226     * list, and returns a possibly modified list.
    216227     *
    217      * @param uri
    218      *        The URI corresponding to this proxy info list.
     228     * @param channel
     229     *        The channel corresponding to this proxy info list.
    219230     * @param info
    220231     *        Information about the URI's protocol.
    221232     * @param proxyInfo
    222233     *        The proxy info list to be modified.  This is an inout param.
    223234     */
    224     NS_HIDDEN_(void) ApplyFilters(nsIURI *uri, const nsProtocolInfo &info,
     235    NS_HIDDEN_(void) ApplyFilters(nsIChannel *channel, const nsProtocolInfo &info,
    225236                                  nsIProxyInfo **proxyInfo);
    226237
    227238    /**
    228239     * This method is a simple wrapper around ApplyFilters that takes the
    229240     * proxy info list inout param as a nsCOMPtr.
    230241     */
    231     inline void ApplyFilters(nsIURI *uri, const nsProtocolInfo &info,
     242    inline void ApplyFilters(nsIChannel *channel, const nsProtocolInfo &info,
    232243                             nsCOMPtr<nsIProxyInfo> &proxyInfo)
    233244    {
    234245      nsIProxyInfo *pi = nullptr;
    235246      proxyInfo.swap(pi);
    236       ApplyFilters(uri, info, &pi);
     247      ApplyFilters(channel, info, &pi);
    237248      proxyInfo.swap(pi);
    238249    }
    239250
    protected: 
    317328        }
    318329    };
    319330
    320     // This structure is allocated for each registered nsIProtocolProxyFilter.
     331    // An instance of this struct is allocated for each registered
     332    // nsIProtocolProxyFilter and each nsIProtocolProxyChannelFilter.
    321333    struct FilterLink {
    322334      struct FilterLink                *next;
    323335      uint32_t                          position;
    324       nsCOMPtr<nsIProtocolProxyFilter>  filter;
    325 
     336      nsCOMPtr<nsIProtocolProxyFilter> filter;
     337      nsCOMPtr<nsIProtocolProxyChannelFilter> channelFilter;
    326338      FilterLink(uint32_t p, nsIProtocolProxyFilter *f)
    327         : next(nullptr), position(p), filter(f) {}
    328 
     339        : next(nullptr), position(p), filter(f), channelFilter(nullptr) {}
     340      FilterLink(uint32_t p, nsIProtocolProxyChannelFilter *cf)
     341        : next(nullptr), position(p), filter(nullptr), channelFilter(cf) {}
    329342      // Chain deletion to simplify cleaning up the filter links
    330343      ~FilterLink() { if (next) delete next; }
    331344    };
    332345
     346private:
     347    // Private methods to insert and remove FilterLinks from the FilterLink chain.
     348    nsresult InsertFilterLink(FilterLink *link, uint32_t position);
     349    nsresult RemoveFilterLink(nsISupports *givenObject);
     350
     351protected:
    333352    // Indicates if local hosts (plain hostnames, no dots) should use the proxy
    334353    bool mFilterLocalHosts;
    335354
    protected: 
    364383    int32_t                      mFailedProxyTimeout;
    365384
    366385private:
    367     nsresult AsyncResolveInternal(nsIURI *uri, uint32_t flags,
     386    nsresult AsyncResolveInternal(nsIChannel *channel, uint32_t flags,
    368387                                  nsIProtocolProxyCallback *callback,
    369388                                  nsICancelable **result,
    370389                                  bool isSyncOK);
    371390
    372391};
    373392
     393NS_DEFINE_STATIC_IID_ACCESSOR(nsProtocolProxyService, NS_PROTOCOL_PROXY_SERVICE_IMPL_CID)
     394
    374395#endif // !nsProtocolProxyService_h__
  • netwerk/protocol/ftp/nsFtpConnectionThread.cpp

    diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
    index 6d8d9f1..5073dbb 100644
    a b nsFtpState::Init(nsFtpChannel *channel) 
    18721872        do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID);
    18731873
    18741874    if (pps && !mChannel->ProxyInfo()) {
    1875         pps->AsyncResolve(mChannel->URI(), 0, this,
     1875        pps->AsyncResolve(mChannel, 0, this,
    18761876                          getter_AddRefs(mProxyRequest));
    18771877    }
    18781878
    nsFtpState::CloseWithStatus(nsresult status) 
    23582358}
    23592359
    23602360static nsresult
    2361 CreateHTTPProxiedChannel(nsIURI *uri, nsIProxyInfo *pi, nsIChannel **newChannel)
     2361CreateHTTPProxiedChannel(nsIChannel *channel, nsIProxyInfo *pi, nsIChannel **newChannel)
    23622362{
    23632363    nsresult rv;
    23642364    nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
    CreateHTTPProxiedChannel(nsIURI *uri, nsIProxyInfo *pi, nsIChannel **newChannel) 
    23742374    if (NS_FAILED(rv))
    23752375        return rv;
    23762376
     2377    nsCOMPtr<nsIURI> uri;
     2378    channel->GetURI(getter_AddRefs(uri));
     2379
    23772380    return pph->NewProxiedChannel(uri, pi, 0, nullptr, newChannel);
    23782381}
    23792382
    23802383NS_IMETHODIMP
    2381 nsFtpState::OnProxyAvailable(nsICancelable *request, nsIURI *uri,
     2384nsFtpState::OnProxyAvailable(nsICancelable *request, nsIChannel *channel,
    23822385                             nsIProxyInfo *pi, nsresult status)
    23832386{
    23842387  mProxyRequest = nullptr;
    nsFtpState::OnProxyAvailable(nsICancelable *request, nsIURI *uri, 
    23952398        LOG(("FTP:(%p) Configured to use a HTTP proxy channel\n", this));
    23962399
    23972400        nsCOMPtr<nsIChannel> newChannel;
    2398         if (NS_SUCCEEDED(CreateHTTPProxiedChannel(uri, pi,
     2401        if (NS_SUCCEEDED(CreateHTTPProxiedChannel(channel, pi,
    23992402                                                  getter_AddRefs(newChannel))) &&
    24002403            NS_SUCCEEDED(mChannel->Redirect(newChannel,
    24012404                                            nsIChannelEventSink::REDIRECT_INTERNAL,
  • netwerk/protocol/http/HttpBaseChannel.cpp

    diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp
    index 40123da..64b202a 100644
    a b HttpBaseChannel::HttpBaseChannel() 
    6868  , mContentDispositionHint(UINT32_MAX)
    6969  , mHttpHandler(gHttpHandler)
    7070  , mRedirectCount(0)
     71  , mProxyURI(nullptr)
    7172{
    7273  LOG(("Creating HttpBaseChannel @%x\n", this));
    7374
    HttpBaseChannel::SetReferrer(nsIURI *referrer) 
    10751076}
    10761077
    10771078NS_IMETHODIMP
     1079HttpBaseChannel::GetProxyURI(nsIURI** proxyURI)
     1080{
     1081  NS_ENSURE_ARG_POINTER(proxyURI);
     1082  *proxyURI = mProxyURI;
     1083  NS_IF_ADDREF(*proxyURI);
     1084  return NS_OK;
     1085}
     1086
     1087NS_IMETHODIMP
    10781088HttpBaseChannel::GetRequestHeader(const nsACString& aHeader,
    10791089                                  nsACString& aValue)
    10801090{
  • netwerk/protocol/http/HttpBaseChannel.h

    diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h
    index e177a39..abaf789 100644
    a b public: 
    115115  NS_IMETHOD SetRequestMethod(const nsACString& aMethod);
    116116  NS_IMETHOD GetReferrer(nsIURI **referrer);
    117117  NS_IMETHOD SetReferrer(nsIURI *referrer);
     118  NS_IMETHOD GetProxyURI(nsIURI **proxyURI);
    118119  NS_IMETHOD GetRequestHeader(const nsACString& aHeader, nsACString& aValue);
    119120  NS_IMETHOD SetRequestHeader(const nsACString& aHeader,
    120121                              const nsACString& aValue, bool aMerge);
  • netwerk/protocol/http/nsHttpChannel.cpp

    diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
    index 6449769..41ef8bb 100644
    a b nsHttpChannel::ResolveProxy() 
    18231823    // then it is ok to use that version.
    18241824    nsCOMPtr<nsIProtocolProxyService2> pps2 = do_QueryInterface(pps);
    18251825    if (pps2) {
    1826         rv = pps2->AsyncResolve2(mProxyURI ? mProxyURI : mURI, mProxyResolveFlags,
     1826        rv = pps2->AsyncResolve2(this, mProxyResolveFlags,
    18271827                                 this, getter_AddRefs(mProxyRequest));
    18281828    } else {
    1829         rv = pps->AsyncResolve(mProxyURI ? mProxyURI : mURI, mProxyResolveFlags,
     1829        rv = pps->AsyncResolve(this, mProxyResolveFlags,
    18301830                               this, getter_AddRefs(mProxyRequest));
    18311831    }
    18321832
    nsHttpChannel::SetPriority(int32_t value) 
    47074707//-----------------------------------------------------------------------------
    47084708
    47094709NS_IMETHODIMP
    4710 nsHttpChannel::OnProxyAvailable(nsICancelable *request, nsIURI *uri,
     4710nsHttpChannel::OnProxyAvailable(nsICancelable *request, nsIChannel *channel,
    47114711                                nsIProxyInfo *pi, nsresult status)
    47124712{
    47134713    LOG(("nsHttpChannel::OnProxyAvailable [this=%p pi=%p status=%x mStatus=%x]\n",
  • netwerk/protocol/http/nsIHttpChannel.idl

    diff --git a/netwerk/protocol/http/nsIHttpChannel.idl b/netwerk/protocol/http/nsIHttpChannel.idl
    index abb2ee4..24df18b 100644
    a b interface nsIHttpChannel : nsIChannel 
    5656    attribute nsIURI referrer;
    5757
    5858    /**
     59     * Read the proxy URI, which, if non-null, will be used to resolve
     60     * proxies for this channel.
     61     */
     62    readonly attribute nsIURI proxyURI;
     63
     64    /**
    5965     * Get the value of a particular request header.
    6066     *
    6167     * @param aHeader
  • netwerk/protocol/viewsource/nsViewSourceChannel.cpp

    diff --git a/netwerk/protocol/viewsource/nsViewSourceChannel.cpp b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp
    index f92c36e..350c920 100644
    a b nsViewSourceChannel::GetName(nsACString &result) 
    115115}
    116116
    117117NS_IMETHODIMP
     118nsViewSourceChannel::GetProxyURI(nsIURI** proxyURI)
     119{
     120    return NS_ERROR_NOT_IMPLEMENTED;
     121}
     122
     123NS_IMETHODIMP
    118124nsViewSourceChannel::IsPending(bool *result)
    119125{
    120126    NS_ENSURE_TRUE(mChannel, NS_ERROR_FAILURE);
  • netwerk/protocol/websocket/WebSocketChannel.cpp

    diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp
    index 90f023c..5e14f97 100644
    a b WebSocketChannel::ApplyForAdmission() 
    22922292
    22932293  MOZ_ASSERT(!mCancelable);
    22942294
    2295   return pps->AsyncResolve(mURI,
     2295  return pps->AsyncResolve(mHttpChannel,
    22962296                           nsIProtocolProxyService::RESOLVE_PREFER_HTTPS_PROXY |
    22972297                           nsIProtocolProxyService::RESOLVE_ALWAYS_TUNNEL,
    22982298                           this, getter_AddRefs(mCancelable));
    WebSocketChannel::OnLookupComplete(nsICancelable *aRequest, 
    24062406
    24072407// nsIProtocolProxyCallback
    24082408NS_IMETHODIMP
    2409 WebSocketChannel::OnProxyAvailable(nsICancelable *aRequest, nsIURI *aURI,
     2409WebSocketChannel::OnProxyAvailable(nsICancelable *aRequest, nsIChannel *aChannel,
    24102410                                   nsIProxyInfo *pi, nsresult status)
    24112411{
    24122412  if (mStopped) {