Loading netwerk/base/nsIProtocolProxyService.idl +29 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,35 @@ interface nsIProtocolProxyService : nsISupports in unsigned long aFailoverTimeout, in nsIProxyInfo aFailoverProxy); /** * This method may be called to construct a nsIProxyInfo instance for * a SOCKS connection, with the specified username and password. * @param aHost * The proxy hostname or IP address. * @param aPort * The proxy port. * @param aUsername * The SOCKS5 username * @param aPassword * The SOCKS5 password * @param aFlags * Flags associated with this connection. See nsIProxyInfo.idl * for currently defined flags. * @param aFailoverTimeout * Specifies the length of time (in seconds) to ignore this proxy if * this proxy fails. Pass UINT32_MAX to specify the default * timeout value, causing nsIProxyInfo::failoverTimeout to be * assigned the default value. * @param aFailoverProxy * Specifies the next proxy to try if this proxy fails. This * parameter may be null. */ nsIProxyInfo newSOCKSProxyInfo(in AUTF8String aHost, in long aPort, in ACString aUsername, in ACString aPassword, in unsigned long aFlags, in unsigned long aFailoverTimeout, in nsIProxyInfo aFailoverProxy); /** * If the proxy identified by aProxyInfo is unavailable for some reason, * this method may be called to access an alternate proxy that may be used Loading netwerk/base/nsIProxyInfo.idl +11 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /** * This interface identifies a proxy server. */ [scriptable, uuid(9e557d99-7af0-4895-95b7-e6dba28c9ad9)] [scriptable, uuid(63fff172-2564-4138-96c6-3ae7d245fbed)] interface nsIProxyInfo : nsISupports { /** Loading Loading @@ -50,6 +50,16 @@ interface nsIProxyInfo : nsISupports */ readonly attribute unsigned long resolveFlags; /** * Specifies a SOCKS5 username. */ readonly attribute ACString username; /** * Specifies a SOCKS5 password. */ readonly attribute ACString password; /** * This attribute specifies the failover timeout in seconds for this proxy. * If a nsIProxyInfo is reported as failed via nsIProtocolProxyService:: Loading netwerk/base/nsProtocolProxyService.cpp +34 −5 Original line number Diff line number Diff line Loading @@ -613,6 +613,12 @@ nsProtocolProxyService::PrefsChanged(nsIPrefBranch *prefBranch, if (!pref || !strcmp(pref, PROXY_PREF("socks_port"))) proxy_GetIntPref(prefBranch, PROXY_PREF("socks_port"), mSOCKSProxyPort); if (!pref || !strcmp(pref, PROXY_PREF("socks_username"))) proxy_GetStringPref(prefBranch, PROXY_PREF("socks_username"), mSOCKSProxyUsername); if (!pref || !strcmp(pref, PROXY_PREF("socks_password"))) proxy_GetStringPref(prefBranch, PROXY_PREF("socks_password"), mSOCKSProxyPassword); if (!pref || !strcmp(pref, PROXY_PREF("socks_version"))) { int32_t version; proxy_GetIntPref(prefBranch, PROXY_PREF("socks_version"), version); Loading Loading @@ -1330,10 +1336,25 @@ nsProtocolProxyService::NewProxyInfo(const nsACString &aType, } NS_ENSURE_TRUE(type, NS_ERROR_INVALID_ARG); if (aPort <= 0) aPort = -1; return NewProxyInfo_Internal(type, aHost, aPort, mSOCKSProxyUsername, mSOCKSProxyPassword, aFlags, aFailoverTimeout, aFailoverProxy, 0, aResult); } return NewProxyInfo_Internal(type, aHost, aPort, aFlags, aFailoverTimeout, NS_IMETHODIMP nsProtocolProxyService::NewSOCKSProxyInfo(const nsACString &aHost, int32_t aPort, const nsACString &aUsername, const nsACString &aPassword, uint32_t aFlags, uint32_t aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **aResult) { return NewProxyInfo_Internal(kProxyType_SOCKS, aHost, aPort, aUsername, aPassword, aFlags, aFailoverTimeout, aFailoverProxy, 0, aResult); } Loading Loading @@ -1641,12 +1662,17 @@ nsresult nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, const nsACString &aHost, int32_t aPort, const nsACString &aUsername, const nsACString &aPassword, uint32_t aFlags, uint32_t aFailoverTimeout, nsIProxyInfo *aFailoverProxy, uint32_t aResolveFlags, nsIProxyInfo **aResult) { if (aPort <= 0) aPort = -1; nsCOMPtr<nsProxyInfo> failover; if (aFailoverProxy) { failover = do_QueryInterface(aFailoverProxy); Loading @@ -1660,6 +1686,8 @@ nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, proxyInfo->mType = aType; proxyInfo->mHost = aHost; proxyInfo->mPort = aPort; proxyInfo->mUsername = aUsername; proxyInfo->mPassword = aPassword; proxyInfo->mFlags = aFlags; proxyInfo->mResolveFlags = aResolveFlags; proxyInfo->mTimeout = aFailoverTimeout == UINT32_MAX Loading Loading @@ -1826,8 +1854,9 @@ nsProtocolProxyService::Resolve_Internal(nsIChannel *channel, } if (type) { rv = NewProxyInfo_Internal(type, *host, port, proxyFlags, UINT32_MAX, nullptr, flags, rv = NewProxyInfo_Internal(type, *host, port, mSOCKSProxyUsername, mSOCKSProxyPassword, proxyFlags, UINT32_MAX, nullptr, flags, result); if (NS_FAILED(rv)) return rv; Loading netwerk/base/nsProtocolProxyService.h +8 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,10 @@ protected: * The proxy host name (UTF-8 ok). * @param port * The proxy port number. * @param username * The username for the proxy (ASCII). May be "", but not null. * @param password * The password for the proxy (ASCII). May be "", but not null. * @param flags * The proxy flags (nsIProxyInfo::flags). * @param timeout Loading @@ -191,6 +195,8 @@ protected: nsresult NewProxyInfo_Internal(const char *type, const nsACString &host, int32_t port, const nsACString &username, const nsACString &password, uint32_t flags, uint32_t timeout, nsIProxyInfo *next, Loading Loading @@ -375,6 +381,8 @@ protected: int32_t mSOCKSProxyPort; int32_t mSOCKSProxyVersion; bool mSOCKSProxyRemoteDNS; nsCString mSOCKSProxyUsername; nsCString mSOCKSProxyPassword; bool mProxyOverTLS; nsRefPtr<nsPACMan> mPACMan; // non-null if we are using PAC Loading netwerk/base/nsProxyInfo.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,20 @@ nsProxyInfo::GetResolveFlags(uint32_t *result) return NS_OK; } NS_IMETHODIMP nsProxyInfo::GetUsername(nsACString &result) { result = mUsername; return NS_OK; } NS_IMETHODIMP nsProxyInfo::GetPassword(nsACString &result) { result = mPassword; return NS_OK; } NS_IMETHODIMP nsProxyInfo::GetFailoverTimeout(uint32_t *result) { Loading Loading
netwerk/base/nsIProtocolProxyService.idl +29 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,35 @@ interface nsIProtocolProxyService : nsISupports in unsigned long aFailoverTimeout, in nsIProxyInfo aFailoverProxy); /** * This method may be called to construct a nsIProxyInfo instance for * a SOCKS connection, with the specified username and password. * @param aHost * The proxy hostname or IP address. * @param aPort * The proxy port. * @param aUsername * The SOCKS5 username * @param aPassword * The SOCKS5 password * @param aFlags * Flags associated with this connection. See nsIProxyInfo.idl * for currently defined flags. * @param aFailoverTimeout * Specifies the length of time (in seconds) to ignore this proxy if * this proxy fails. Pass UINT32_MAX to specify the default * timeout value, causing nsIProxyInfo::failoverTimeout to be * assigned the default value. * @param aFailoverProxy * Specifies the next proxy to try if this proxy fails. This * parameter may be null. */ nsIProxyInfo newSOCKSProxyInfo(in AUTF8String aHost, in long aPort, in ACString aUsername, in ACString aPassword, in unsigned long aFlags, in unsigned long aFailoverTimeout, in nsIProxyInfo aFailoverProxy); /** * If the proxy identified by aProxyInfo is unavailable for some reason, * this method may be called to access an alternate proxy that may be used Loading
netwerk/base/nsIProxyInfo.idl +11 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ /** * This interface identifies a proxy server. */ [scriptable, uuid(9e557d99-7af0-4895-95b7-e6dba28c9ad9)] [scriptable, uuid(63fff172-2564-4138-96c6-3ae7d245fbed)] interface nsIProxyInfo : nsISupports { /** Loading Loading @@ -50,6 +50,16 @@ interface nsIProxyInfo : nsISupports */ readonly attribute unsigned long resolveFlags; /** * Specifies a SOCKS5 username. */ readonly attribute ACString username; /** * Specifies a SOCKS5 password. */ readonly attribute ACString password; /** * This attribute specifies the failover timeout in seconds for this proxy. * If a nsIProxyInfo is reported as failed via nsIProtocolProxyService:: Loading
netwerk/base/nsProtocolProxyService.cpp +34 −5 Original line number Diff line number Diff line Loading @@ -613,6 +613,12 @@ nsProtocolProxyService::PrefsChanged(nsIPrefBranch *prefBranch, if (!pref || !strcmp(pref, PROXY_PREF("socks_port"))) proxy_GetIntPref(prefBranch, PROXY_PREF("socks_port"), mSOCKSProxyPort); if (!pref || !strcmp(pref, PROXY_PREF("socks_username"))) proxy_GetStringPref(prefBranch, PROXY_PREF("socks_username"), mSOCKSProxyUsername); if (!pref || !strcmp(pref, PROXY_PREF("socks_password"))) proxy_GetStringPref(prefBranch, PROXY_PREF("socks_password"), mSOCKSProxyPassword); if (!pref || !strcmp(pref, PROXY_PREF("socks_version"))) { int32_t version; proxy_GetIntPref(prefBranch, PROXY_PREF("socks_version"), version); Loading Loading @@ -1330,10 +1336,25 @@ nsProtocolProxyService::NewProxyInfo(const nsACString &aType, } NS_ENSURE_TRUE(type, NS_ERROR_INVALID_ARG); if (aPort <= 0) aPort = -1; return NewProxyInfo_Internal(type, aHost, aPort, mSOCKSProxyUsername, mSOCKSProxyPassword, aFlags, aFailoverTimeout, aFailoverProxy, 0, aResult); } return NewProxyInfo_Internal(type, aHost, aPort, aFlags, aFailoverTimeout, NS_IMETHODIMP nsProtocolProxyService::NewSOCKSProxyInfo(const nsACString &aHost, int32_t aPort, const nsACString &aUsername, const nsACString &aPassword, uint32_t aFlags, uint32_t aFailoverTimeout, nsIProxyInfo *aFailoverProxy, nsIProxyInfo **aResult) { return NewProxyInfo_Internal(kProxyType_SOCKS, aHost, aPort, aUsername, aPassword, aFlags, aFailoverTimeout, aFailoverProxy, 0, aResult); } Loading Loading @@ -1641,12 +1662,17 @@ nsresult nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, const nsACString &aHost, int32_t aPort, const nsACString &aUsername, const nsACString &aPassword, uint32_t aFlags, uint32_t aFailoverTimeout, nsIProxyInfo *aFailoverProxy, uint32_t aResolveFlags, nsIProxyInfo **aResult) { if (aPort <= 0) aPort = -1; nsCOMPtr<nsProxyInfo> failover; if (aFailoverProxy) { failover = do_QueryInterface(aFailoverProxy); Loading @@ -1660,6 +1686,8 @@ nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, proxyInfo->mType = aType; proxyInfo->mHost = aHost; proxyInfo->mPort = aPort; proxyInfo->mUsername = aUsername; proxyInfo->mPassword = aPassword; proxyInfo->mFlags = aFlags; proxyInfo->mResolveFlags = aResolveFlags; proxyInfo->mTimeout = aFailoverTimeout == UINT32_MAX Loading Loading @@ -1826,8 +1854,9 @@ nsProtocolProxyService::Resolve_Internal(nsIChannel *channel, } if (type) { rv = NewProxyInfo_Internal(type, *host, port, proxyFlags, UINT32_MAX, nullptr, flags, rv = NewProxyInfo_Internal(type, *host, port, mSOCKSProxyUsername, mSOCKSProxyPassword, proxyFlags, UINT32_MAX, nullptr, flags, result); if (NS_FAILED(rv)) return rv; Loading
netwerk/base/nsProtocolProxyService.h +8 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,10 @@ protected: * The proxy host name (UTF-8 ok). * @param port * The proxy port number. * @param username * The username for the proxy (ASCII). May be "", but not null. * @param password * The password for the proxy (ASCII). May be "", but not null. * @param flags * The proxy flags (nsIProxyInfo::flags). * @param timeout Loading @@ -191,6 +195,8 @@ protected: nsresult NewProxyInfo_Internal(const char *type, const nsACString &host, int32_t port, const nsACString &username, const nsACString &password, uint32_t flags, uint32_t timeout, nsIProxyInfo *next, Loading Loading @@ -375,6 +381,8 @@ protected: int32_t mSOCKSProxyPort; int32_t mSOCKSProxyVersion; bool mSOCKSProxyRemoteDNS; nsCString mSOCKSProxyUsername; nsCString mSOCKSProxyPassword; bool mProxyOverTLS; nsRefPtr<nsPACMan> mPACMan; // non-null if we are using PAC Loading
netwerk/base/nsProxyInfo.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,20 @@ nsProxyInfo::GetResolveFlags(uint32_t *result) return NS_OK; } NS_IMETHODIMP nsProxyInfo::GetUsername(nsACString &result) { result = mUsername; return NS_OK; } NS_IMETHODIMP nsProxyInfo::GetPassword(nsACString &result) { result = mPassword; return NS_OK; } NS_IMETHODIMP nsProxyInfo::GetFailoverTimeout(uint32_t *result) { Loading