gecko-dev/netwerk/base/moz.build
Polly Shaw 091db15fe1 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: HinC1UevOon

--HG--
extra : rebase_source : cf29f76826cc7728fd36505c8271bf50001c644c
2018-04-22 18:13:11 +01:00

309 lines
8.2 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
XPIDL_SOURCES += [
'mozIThirdPartyUtil.idl',
'nsIApplicationCache.idl',
'nsIApplicationCacheChannel.idl',
'nsIApplicationCacheContainer.idl',
'nsIApplicationCacheService.idl',
'nsIArrayBufferInputStream.idl',
'nsIAsyncStreamCopier.idl',
'nsIAsyncStreamCopier2.idl',
'nsIAsyncVerifyRedirectCallback.idl',
'nsIAuthInformation.idl',
'nsIAuthModule.idl',
'nsIAuthPrompt.idl',
'nsIAuthPrompt2.idl',
'nsIAuthPromptAdapterFactory.idl',
'nsIAuthPromptCallback.idl',
'nsIAuthPromptProvider.idl',
'nsIBackgroundFileSaver.idl',
'nsIBufferedStreams.idl',
'nsIByteRangeRequest.idl',
'nsICacheInfoChannel.idl',
'nsICachingChannel.idl',
'nsICancelable.idl',
'nsICaptivePortalService.idl',
'nsIChannel.idl',
'nsIChannelEventSink.idl',
'nsIChannelWithDivertableParentListener.idl',
'nsIChildChannel.idl',
'nsIClassifiedChannel.idl',
'nsIClassOfService.idl',
'nsIContentSniffer.idl',
'nsIDashboard.idl',
'nsIDashboardEventNotifier.idl',
'nsIDeprecationWarner.idl',
'nsIDHCPClient.idl',
'nsIDivertableChannel.idl',
'nsIDownloader.idl',
'nsIEncodedChannel.idl',
'nsIExternalProtocolHandler.idl',
'nsIFileStreams.idl',
'nsIFileURL.idl',
'nsIForcePendingChannel.idl',
'nsIFormPOSTActionChannel.idl',
'nsIHttpAuthenticatorCallback.idl',
'nsIHttpPushListener.idl',
'nsIIncrementalDownload.idl',
'nsIIncrementalStreamLoader.idl',
'nsIInputStreamChannel.idl',
'nsIInputStreamPump.idl',
'nsIIOService.idl',
'nsILoadContextInfo.idl',
'nsILoadGroup.idl',
'nsILoadGroupChild.idl',
'nsILoadInfo.idl',
'nsIMIMEInputStream.idl',
'nsIMultiPartChannel.idl',
'nsINestedURI.idl',
'nsINetAddr.idl',
'nsINetUtil.idl',
'nsINetworkActivityData.idl',
'nsINetworkInfoService.idl',
'nsINetworkInterceptController.idl',
'nsINetworkLinkService.idl',
'nsINetworkPredictor.idl',
'nsINetworkPredictorVerifier.idl',
'nsINetworkProperties.idl',
'nsINullChannel.idl',
'nsIParentChannel.idl',
'nsIParentRedirectingChannel.idl',
'nsIPermission.idl',
'nsIPermissionManager.idl',
'nsIPrivateBrowsingChannel.idl',
'nsIProgressEventSink.idl',
'nsIPrompt.idl',
'nsIProtocolHandler.idl',
'nsIProtocolProxyCallback.idl',
'nsIProtocolProxyFilter.idl',
'nsIProtocolProxyService.idl',
'nsIProtocolProxyService2.idl',
'nsIProxiedChannel.idl',
'nsIProxiedProtocolHandler.idl',
'nsIProxyInfo.idl',
'nsIRandomGenerator.idl',
'nsIRedirectChannelRegistrar.idl',
'nsIRedirectHistoryEntry.idl',
'nsIRedirectResultListener.idl',
'nsIRequest.idl',
'nsIRequestContext.idl',
'nsIRequestObserver.idl',
'nsIRequestObserverProxy.idl',
'nsIResumableChannel.idl',
'nsISecCheckWrapChannel.idl',
'nsISecureBrowserUI.idl',
'nsISecurityEventSink.idl',
'nsISecurityInfoProvider.idl',
'nsISensitiveInfoHiddenURI.idl',
'nsISerializationHelper.idl',
'nsIServerSocket.idl',
'nsISimpleStreamListener.idl',
'nsISocketFilter.idl',
'nsISocketTransport.idl',
'nsISocketTransportService.idl',
'nsISpeculativeConnect.idl',
'nsIStandardURL.idl',
'nsIStreamListener.idl',
'nsIStreamListenerTee.idl',
'nsIStreamLoader.idl',
'nsIStreamTransportService.idl',
'nsISyncStreamListener.idl',
'nsISystemProxySettings.idl',
'nsIThreadRetargetableRequest.idl',
'nsIThreadRetargetableStreamListener.idl',
'nsIThrottledInputChannel.idl',
'nsITimedChannel.idl',
'nsITLSServerSocket.idl',
'nsITraceableChannel.idl',
'nsITransport.idl',
'nsIUDPSocket.idl',
'nsIUploadChannel.idl',
'nsIUploadChannel2.idl',
'nsIURI.idl',
'nsIURIClassifier.idl',
'nsIURIMutator.idl',
'nsIURIWithPrincipal.idl',
'nsIURL.idl',
'nsIURLParser.idl',
'nsPILoadGroupInternal.idl',
'nsPISocketTransportService.idl',
]
if CONFIG['MOZ_TOOLKIT_SEARCH']:
XPIDL_SOURCES += [
'nsIBrowserSearchService.idl',
]
XPIDL_MODULE = 'necko'
EXPORTS += [
'netCore.h',
'nsASocketHandler.h',
'nsAsyncRedirectVerifyHelper.h',
'nsFileStreams.h',
'nsInputStreamPump.h',
'nsMIMEInputStream.h',
'nsNetUtil.h',
'nsReadLine.h',
'nsSerializationHelper.h',
'nsSimpleNestedURI.h',
'nsSimpleURI.h',
'nsStreamListenerWrapper.h',
'nsURIHashKey.h',
'nsURLHelper.h',
'nsURLParsers.h',
'SimpleChannel.h',
]
EXPORTS.mozilla += [
'LoadContextInfo.h',
'LoadInfo.h',
'LoadTainting.h',
'nsRedirectHistoryEntry.h',
]
EXPORTS.mozilla.net += [
'CaptivePortalService.h',
'ChannelDiverterChild.h',
'ChannelDiverterParent.h',
'Dashboard.h',
'DashboardTypes.h',
'MemoryDownloader.h',
'PartiallySeekableInputStream.h',
'Predictor.h',
'ReferrerPolicy.h',
'SimpleChannelParent.h',
'TCPFastOpen.h',
]
UNIFIED_SOURCES += [
'ArrayBufferInputStream.cpp',
'BackgroundFileSaver.cpp',
'CaptivePortalService.cpp',
'ChannelDiverterChild.cpp',
'ChannelDiverterParent.cpp',
'Dashboard.cpp',
'EventTokenBucket.cpp',
'LoadContextInfo.cpp',
'LoadInfo.cpp',
'MemoryDownloader.cpp',
'NetworkActivityMonitor.cpp',
'nsAsyncRedirectVerifyHelper.cpp',
'nsAsyncStreamCopier.cpp',
'nsAuthInformationHolder.cpp',
'nsBase64Encoder.cpp',
'nsBaseChannel.cpp',
'nsBaseContentStream.cpp',
'nsBufferedStreams.cpp',
'nsChannelClassifier.cpp',
'nsDirectoryIndexStream.cpp',
'nsDNSPrefetch.cpp',
'nsDownloader.cpp',
'nsFileStreams.cpp',
'nsIncrementalDownload.cpp',
'nsIncrementalStreamLoader.cpp',
'nsInputStreamChannel.cpp',
'nsInputStreamPump.cpp',
'nsIOService.cpp',
'nsIURIMutatorUtils.cpp',
'nsLoadGroup.cpp',
'nsMediaFragmentURIParser.cpp',
'nsMIMEInputStream.cpp',
'nsNetAddr.cpp',
'nsNetUtil.cpp',
'nsPACMan.cpp',
'nsPreloadedStream.cpp',
'nsProtocolProxyService.cpp',
'nsProxyInfo.cpp',
'nsRedirectHistoryEntry.cpp',
'nsRequestObserverProxy.cpp',
'nsSecCheckWrapChannel.cpp',
'nsSerializationHelper.cpp',
'nsServerSocket.cpp',
'nsSimpleNestedURI.cpp',
'nsSimpleStreamListener.cpp',
'nsSimpleURI.cpp',
'nsSocketTransport2.cpp',
'nsSocketTransportService2.cpp',
'nsStandardURL.cpp',
'nsStreamListenerTee.cpp',
'nsStreamListenerWrapper.cpp',
'nsStreamLoader.cpp',
'nsStreamTransportService.cpp',
'nsSyncStreamListener.cpp',
'nsTransportUtils.cpp',
'nsUDPSocket.cpp',
'nsURLHelper.cpp',
'nsURLParsers.cpp',
'PartiallySeekableInputStream.cpp',
'PollableEvent.cpp',
'Predictor.cpp',
'ProxyAutoConfig.cpp',
'RedirectChannelRegistrar.cpp',
'RequestContextService.cpp',
'SimpleBuffer.cpp',
'SimpleChannel.cpp',
'SimpleChannelParent.cpp',
'TCPFastOpenLayer.cpp',
'ThrottleQueue.cpp',
'Tickler.cpp',
'TLSServerSocket.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
'nsURLHelperWin.cpp',
'ShutdownLayer.cpp',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SOURCES += [
'nsURLHelperOSX.cpp',
]
else:
SOURCES += [
'nsURLHelperUnix.cpp',
]
# nsINetworkInfoService support.
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
'NetworkInfoServiceWindows.cpp',
'nsNetworkInfoService.cpp',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SOURCES += [
'NetworkInfoServiceCocoa.cpp',
'nsNetworkInfoService.cpp',
]
elif CONFIG['OS_ARCH'] == 'Linux':
SOURCES += [
'NetworkInfoServiceLinux.cpp',
'nsNetworkInfoService.cpp',
]
EXTRA_JS_MODULES += [
'NetUtil.jsm',
]
DIRS += [ 'mozurl' ]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'/docshell/base',
'/dom/base',
'/netwerk/protocol/http',
'/netwerk/socket',
'/security/pkix/include'
]
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']