2005-03-25 06:41:33 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
#ifndef nsPACMan_h__
|
|
|
|
#define nsPACMan_h__
|
|
|
|
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
#include "mozilla/Atomics.h"
|
2018-07-10 18:42:01 +03:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/LinkedList.h"
|
|
|
|
#include "mozilla/Logging.h"
|
|
|
|
#include "mozilla/net/NeckoTargetHolder.h"
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIChannelEventSink.h"
|
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIStreamLoader.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "ProxyAutoConfig.h"
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2013-09-22 07:04:57 +04:00
|
|
|
class nsISystemProxySettings;
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
class nsIDHCPClient;
|
2013-09-22 07:04:57 +04:00
|
|
|
class nsIThread;
|
2016-05-19 05:02:57 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
class nsPACMan;
|
2014-08-14 09:59:00 +04:00
|
|
|
class WaitForThreadShutdown;
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class defines a callback interface used by AsyncGetProxyForURI.
|
|
|
|
*/
|
|
|
|
class NS_NO_VTABLE nsPACManCallback : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* This method is invoked on the same thread that called AsyncGetProxyForURI.
|
|
|
|
*
|
|
|
|
* @param status
|
|
|
|
* This parameter indicates whether or not the PAC query succeeded.
|
|
|
|
* @param pacString
|
|
|
|
* This parameter holds the value of the PAC string. It is empty when
|
|
|
|
* status is a failure code.
|
2012-09-15 00:27:46 +04:00
|
|
|
* @param newPACURL
|
|
|
|
* This parameter holds the URL of a new PAC file that should be loaded
|
|
|
|
* before the query is evaluated again. At least one of pacString and
|
|
|
|
* newPACURL should be 0 length.
|
2005-03-25 06:41:33 +03:00
|
|
|
*/
|
2012-09-15 00:27:46 +04:00
|
|
|
virtual void OnQueryComplete(nsresult status,
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
const nsACString &pacString,
|
|
|
|
const nsACString &newPACURL) = 0;
|
2012-09-15 00:27:46 +04:00
|
|
|
};
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
class PendingPACQuery final : public Runnable,
|
|
|
|
public LinkedListElement<PendingPACQuery>
|
2012-09-15 00:27:46 +04:00
|
|
|
{
|
|
|
|
public:
|
2016-10-15 19:41:32 +03:00
|
|
|
PendingPACQuery(nsPACMan *pacMan, nsIURI *uri,
|
|
|
|
nsPACManCallback *callback,
|
2015-03-26 10:11:05 +03:00
|
|
|
bool mainThreadResponse);
|
2016-02-18 05:55:57 +03:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// can be called from either thread
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
void Complete(nsresult status, const nsACString &pacString);
|
|
|
|
void UseAlternatePACFile(const nsACString &pacURL);
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
nsCString mSpec;
|
|
|
|
nsCString mScheme;
|
|
|
|
nsCString mHost;
|
|
|
|
int32_t mPort;
|
|
|
|
|
2017-11-06 06:37:28 +03:00
|
|
|
NS_IMETHOD Run(void) override; /* Runnable */
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsPACMan *mPACMan; // weak reference
|
2015-03-26 10:11:05 +03:00
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsPACManCallback> mCallback;
|
2012-09-15 00:27:46 +04:00
|
|
|
bool mOnMainThreadOnly;
|
2005-03-25 06:41:33 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides an abstraction layer above the PAC thread. The methods
|
|
|
|
* defined on this class are intended to be called on the main thread only.
|
|
|
|
*/
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsPACMan final : public nsIStreamLoaderObserver
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsIInterfaceRequestor
|
|
|
|
, public nsIChannelEventSink
|
2017-07-05 01:48:00 +03:00
|
|
|
, public NeckoTargetHolder
|
2005-03-25 06:41:33 +03:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:24:13 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2017-07-05 01:48:00 +03:00
|
|
|
explicit nsPACMan(nsIEventTarget *mainThreadEventTarget);
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method may be called to shutdown the PAC manager. Any async queries
|
|
|
|
* that have not yet completed will either finish normally or be canceled by
|
|
|
|
* the time this method returns.
|
|
|
|
*/
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This method queries a PAC result asynchronously. The callback runs on the
|
|
|
|
* calling thread. If the PAC file has not yet been loaded, then this method
|
|
|
|
* will queue up the request, and complete it once the PAC file has been
|
|
|
|
* loaded.
|
2016-02-18 05:55:57 +03:00
|
|
|
*
|
2005-03-25 06:41:33 +03:00
|
|
|
* @param uri
|
|
|
|
* The URI to query.
|
|
|
|
* @param callback
|
|
|
|
* The callback to run once the PAC result is available.
|
2012-09-15 00:27:46 +04:00
|
|
|
* @param mustCallbackOnMainThread
|
|
|
|
* If set to false the callback can be made from the PAC thread
|
2005-03-25 06:41:33 +03:00
|
|
|
*/
|
2016-10-15 19:41:32 +03:00
|
|
|
nsresult AsyncGetProxyForURI(nsIURI *uri,
|
2015-03-26 10:11:05 +03:00
|
|
|
nsPACManCallback *callback,
|
2012-09-15 00:27:46 +04:00
|
|
|
bool mustCallbackOnMainThread);
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This method may be called to reload the PAC file. While we are loading
|
|
|
|
* the PAC file, any asynchronous PAC queries will be queued up to be
|
|
|
|
* processed once the PAC file finishes loading.
|
|
|
|
*
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
* @param aSpec
|
2012-12-04 01:28:19 +04:00
|
|
|
* The non normalized uri spec of this URI used for comparison with
|
|
|
|
* system proxy settings to determine if the PAC uri has changed.
|
2005-03-25 06:41:33 +03:00
|
|
|
*/
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
nsresult LoadPACFromURI(const nsACString &aSpec);
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if we are currently loading the PAC file.
|
|
|
|
*/
|
2012-07-30 18:20:58 +04:00
|
|
|
bool IsLoading() { return mLoader != nullptr; }
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2008-01-29 21:38:15 +03:00
|
|
|
/**
|
2013-01-02 01:05:07 +04:00
|
|
|
* Returns true if the given URI matches the URI of our PAC file or the
|
|
|
|
* URI it has been redirected to. In the case of a chain of redirections
|
|
|
|
* only the current one being followed and the original are considered
|
|
|
|
* becuase this information is used, respectively, to determine if we
|
|
|
|
* should bypass the proxy (to fetch the pac file) or if the pac
|
|
|
|
* configuration has changed (and we should reload the pac file)
|
2008-01-29 21:38:15 +03:00
|
|
|
*/
|
2013-01-02 01:05:07 +04:00
|
|
|
bool IsPACURI(const nsACString &spec)
|
|
|
|
{
|
2013-02-12 22:29:27 +04:00
|
|
|
return mPACURISpec.Equals(spec) || mPACURIRedirectSpec.Equals(spec) ||
|
|
|
|
mNormalPACURISpec.Equals(spec);
|
2013-01-02 01:05:07 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPACURI(nsIURI *uri) {
|
2016-08-26 09:40:57 +03:00
|
|
|
if (mPACURISpec.IsEmpty() && mPACURIRedirectSpec.IsEmpty()) {
|
2012-12-04 01:28:19 +04:00
|
|
|
return false;
|
2016-08-26 09:40:57 +03:00
|
|
|
}
|
2012-12-04 01:28:19 +04:00
|
|
|
|
|
|
|
nsAutoCString tmp;
|
2016-08-26 09:40:57 +03:00
|
|
|
nsresult rv = uri->GetSpec(tmp);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-12-04 01:28:19 +04:00
|
|
|
return IsPACURI(tmp);
|
2008-01-29 21:38:15 +03:00
|
|
|
}
|
|
|
|
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
bool IsUsingWPAD() {
|
|
|
|
return mAutoDetect;
|
|
|
|
}
|
|
|
|
|
2014-06-02 16:08:21 +04:00
|
|
|
nsresult Init(nsISystemProxySettings *);
|
2012-09-15 00:27:46 +04:00
|
|
|
static nsPACMan *sInstance;
|
|
|
|
|
|
|
|
// PAC thread operations only
|
|
|
|
void ProcessPendingQ();
|
2018-07-17 02:05:39 +03:00
|
|
|
void CancelPendingQ(nsresult, bool aShutdown);
|
2012-09-15 00:27:46 +04:00
|
|
|
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
void SetWPADOverDHCPEnabled(bool aValue) { mWPADOverDHCPEnabled = aValue; }
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
private:
|
|
|
|
NS_DECL_NSISTREAMLOADEROBSERVER
|
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2005-07-01 00:21:34 +04:00
|
|
|
NS_DECL_NSICHANNELEVENTSINK
|
2005-03-25 06:41:33 +03:00
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
friend class PendingPACQuery;
|
|
|
|
friend class PACLoadComplete;
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
friend class ConfigureWPADComplete;
|
2012-09-15 00:27:46 +04:00
|
|
|
friend class ExecutePACThreadAction;
|
2014-08-14 09:59:00 +04:00
|
|
|
friend class WaitForThreadShutdown;
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
friend class TestPACMan;
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
~nsPACMan();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancel any existing load if any.
|
|
|
|
*/
|
|
|
|
void CancelExistingLoad();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start loading the PAC file.
|
|
|
|
*/
|
2006-05-10 21:30:15 +04:00
|
|
|
void StartLoading();
|
2005-03-25 06:41:33 +03:00
|
|
|
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
/**
|
|
|
|
* Continue loading the PAC file.
|
|
|
|
*/
|
|
|
|
void ContinueLoadingAfterPACUriKnown();
|
|
|
|
|
2018-10-19 12:13:16 +03:00
|
|
|
/**
|
|
|
|
* This method may be called to reload the PAC file. While we are loading
|
|
|
|
* the PAC file, any asynchronous PAC queries will be queued up to be
|
|
|
|
* processed once the PAC file finishes loading.
|
|
|
|
*
|
|
|
|
* @param aSpec
|
|
|
|
* The non normalized uri spec of this URI used for comparison with
|
|
|
|
* system proxy settings to determine if the PAC uri has changed.
|
|
|
|
* @param aResetLoadFailureCount
|
|
|
|
* A flag saying whether the exponential back-off for attempting to reload the
|
|
|
|
* PAC should be reset.
|
|
|
|
*/
|
|
|
|
nsresult LoadPACFromURI(const nsACString &aSpec, bool aResetLoadFailureCount);
|
|
|
|
|
2006-06-13 05:14:20 +04:00
|
|
|
/**
|
|
|
|
* Reload the PAC file if there is reason to.
|
|
|
|
*/
|
|
|
|
void MaybeReloadPAC();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when we fail to load the PAC file.
|
|
|
|
*/
|
|
|
|
void OnLoadFailure();
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
/**
|
|
|
|
* PostQuery() only runs on the PAC thread and it is used to
|
|
|
|
* place a pendingPACQuery into the queue and potentially
|
|
|
|
* execute the queue if it was otherwise empty
|
|
|
|
*/
|
|
|
|
nsresult PostQuery(PendingPACQuery *query);
|
|
|
|
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
// Having found the PAC URI on the PAC thread, copy it to a string which
|
|
|
|
// can be altered on the main thread.
|
|
|
|
void AssignPACURISpec(const nsACString &aSpec);
|
|
|
|
|
2012-09-15 00:27:46 +04:00
|
|
|
// PAC thread operations only
|
|
|
|
void PostProcessPendingQ();
|
2018-07-17 02:05:39 +03:00
|
|
|
void PostCancelPendingQ(nsresult, bool aShutdown = false);
|
2012-09-15 00:27:46 +04:00
|
|
|
bool ProcessPending();
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
nsresult GetPACFromDHCP(nsACString &aSpec);
|
|
|
|
nsresult ConfigureWPAD(nsACString &aSpec);
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
private:
|
2018-07-17 02:05:39 +03:00
|
|
|
/**
|
|
|
|
* Dispatches a runnable to the PAC processing thread. Handles lazy
|
|
|
|
* instantiation of the thread.
|
|
|
|
*
|
|
|
|
* @param aEvent The event to disptach.
|
|
|
|
* @param aSync Whether or not this should be synchronous dispatch.
|
|
|
|
*/
|
|
|
|
nsresult DispatchToPAC(already_AddRefed<nsIRunnable> aEvent, bool aSync = false);
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
ProxyAutoConfig mPAC;
|
2012-09-15 00:27:46 +04:00
|
|
|
nsCOMPtr<nsIThread> mPACThread;
|
|
|
|
nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
nsCOMPtr<nsIDHCPClient> mDHCPClient;
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
LinkedList<PendingPACQuery> mPendingQ; /* pac thread only */
|
2012-09-15 00:27:46 +04:00
|
|
|
|
2013-02-12 22:29:27 +04:00
|
|
|
// These specs are not nsIURI so that they can be used off the main thread.
|
|
|
|
// The non-normalized versions are directly from the configuration, the
|
|
|
|
// normalized version has been extracted from an nsIURI
|
|
|
|
nsCString mPACURISpec;
|
2013-01-02 01:05:07 +04:00
|
|
|
nsCString mPACURIRedirectSpec;
|
2013-02-12 22:29:27 +04:00
|
|
|
nsCString mNormalPACURISpec;
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
nsCOMPtr<nsIStreamLoader> mLoader;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mLoadPending;
|
2016-05-19 05:02:57 +03:00
|
|
|
Atomic<bool, Relaxed> mShutdown;
|
|
|
|
TimeStamp mScheduledReload;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLoadFailureCount;
|
2012-09-15 00:27:46 +04:00
|
|
|
|
|
|
|
bool mInProgress;
|
2016-09-21 04:42:52 +03:00
|
|
|
bool mIncludePath;
|
Bug 356831 - Proxy autodiscovery doesn't check DHCP (option 252) r=bagder,valentin
This patch addresses an issue with Firefox's proxy detection on networks which
do not have their a proxy auto-configuration (PAC) file hosted at
http://wpad/wpad.dat, and instead make use of DHCP option 252 for broadcasting
the address of the PAC file. See https://findproxyforurl.com/wpad-introduction/
for an introduction to the protocol.
Prior to this patch, proxy auto-detect missed out the DHCP query stage, and just
looked for a PAC file at http://wpad/wpad.dat
This patch only addresses the issue for Firefox on Windows, although it defines a
DHCP client interface which could be implemented on other platforms.
The high-level components of this patch are:
* nsIDHCPClient.idl - this is an interface which has been defined for querying the
DHCP server.
* nsPACMan.cpp - where previously when the PAC URL was simply set to a constant of
http://wpad/wpad.dat, it now dispatches an asynchronous command to the proxy
thread. The class ExecutePACThreadAction has been augmented to include an
instruction to 'ConfigureWPAD' (Configure Web-proxy auto-detect), and a new class,
'ConfigureWPADComplete' has been created to relay the result (the URL of the PAC
file) back to the nsPACMan object.
* nsProtocolProxyService.cpp
Minor changes to reflect the fact that the PAC URL not being set does not always
mean there is no PAC to be used; instead it could be in the process of being
detected.
* TestPACMan.cpp
This is a new file, and tests only the DHCP auto-detect functionality.
Some tests use multiple threads, as they test the non-blocking proxy detection.
* DHCPUtils.cpp
A class containing the main logic for querying DHCP.
* WindowsNetworkFunctionsWrapper.cpp
A very thin wrapper around the Windows API calls needed by DHCPUtils.
This class was introduced so it could be mocked out in tests.
* nsWindowsDHCPClient.cpp
* An implementation of the interface defined in nsIDHCPClient.idl. Fairly thin:
most logic is implemented in DHCPUtils.
* TestDHCPUtils.cpp
Tests for DHCPUtils and nsWindowsDHCPClient
MozReview-Commit-ID: 4xFQz3tOLEx
--HG--
extra : rebase_source : dfd5c588406a8b0d92f91cc8a0038ca722b7140a
2018-06-08 01:07:28 +03:00
|
|
|
bool mAutoDetect;
|
|
|
|
bool mWPADOverDHCPEnabled;
|
|
|
|
int32_t mProxyConfigType;
|
2005-03-25 06:41:33 +03:00
|
|
|
};
|
|
|
|
|
2015-11-03 07:35:29 +03:00
|
|
|
extern LazyLogModule gProxyLog;
|
2016-05-19 05:02:57 +03:00
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
2013-11-21 02:55:44 +04:00
|
|
|
|
2018-07-17 02:05:39 +03:00
|
|
|
#endif // nsPACMan_h__
|