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
|
|
|
|
|
|
|
#include "nsProxyInfo.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
// Yes, we support QI to nsProxyInfo
|
2017-07-06 15:00:35 +03:00
|
|
|
NS_IMPL_ISUPPORTS(nsProxyInfo, nsProxyInfo, nsIProxyInfo)
|
2005-03-25 06:41:33 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetHost(nsACString& result) {
|
2005-03-25 06:41:33 +03:00
|
|
|
result = mHost;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetPort(int32_t* result) {
|
2005-03-25 06:41:33 +03:00
|
|
|
*result = mPort;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetType(nsACString& result) {
|
2005-03-25 06:41:33 +03:00
|
|
|
result = mType;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetFlags(uint32_t* result) {
|
2005-03-25 06:41:33 +03:00
|
|
|
*result = mFlags;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-05-13 21:53:27 +04:00
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetResolveFlags(uint32_t* result) {
|
2011-05-13 21:53:27 +04:00
|
|
|
*result = mResolveFlags;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-11-25 00:56:00 +03:00
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetUsername(nsACString& result) {
|
2015-11-25 00:56:00 +03:00
|
|
|
result = mUsername;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetPassword(nsACString& result) {
|
2015-11-25 00:56:00 +03:00
|
|
|
result = mPassword;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2019-05-06 10:22:18 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsProxyInfo::GetProxyAuthorizationHeader(nsACString& result) {
|
|
|
|
result = mProxyAuthorizationHeader;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsProxyInfo::GetConnectionIsolationKey(nsACString& result) {
|
|
|
|
result = mConnectionIsolationKey;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-03-25 06:41:33 +03:00
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetFailoverTimeout(uint32_t* result) {
|
2005-03-25 06:41:33 +03:00
|
|
|
*result = mTimeout;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::GetFailoverProxy(nsIProxyInfo** result) {
|
2005-03-25 06:41:33 +03:00
|
|
|
NS_IF_ADDREF(*result = mNext);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2019-05-01 11:47:10 +03:00
|
|
|
nsProxyInfo::SetFailoverProxy(nsIProxyInfo* proxy) {
|
2005-03-25 06:41:33 +03:00
|
|
|
nsCOMPtr<nsProxyInfo> pi = do_QueryInterface(proxy);
|
|
|
|
NS_ENSURE_ARG(pi);
|
|
|
|
|
|
|
|
pi.swap(mNext);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2012-10-27 23:24:19 +04:00
|
|
|
|
|
|
|
// These pointers are declared in nsProtocolProxyService.cpp and
|
|
|
|
// comparison of mType by string pointer is valid within necko
|
2013-08-21 21:21:40 +04:00
|
|
|
extern const char kProxyType_HTTP[];
|
2014-04-16 02:16:41 +04:00
|
|
|
extern const char kProxyType_HTTPS[];
|
2013-08-21 21:21:40 +04:00
|
|
|
extern const char kProxyType_SOCKS[];
|
|
|
|
extern const char kProxyType_SOCKS4[];
|
|
|
|
extern const char kProxyType_SOCKS5[];
|
|
|
|
extern const char kProxyType_DIRECT[];
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-10-27 23:24:19 +04:00
|
|
|
bool nsProxyInfo::IsDirect() {
|
|
|
|
if (!mType) return true;
|
|
|
|
return mType == kProxyType_DIRECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nsProxyInfo::IsHTTP() { return mType == kProxyType_HTTP; }
|
|
|
|
|
2014-04-16 02:16:41 +04:00
|
|
|
bool nsProxyInfo::IsHTTPS() { return mType == kProxyType_HTTPS; }
|
|
|
|
|
2012-10-27 23:24:19 +04:00
|
|
|
bool nsProxyInfo::IsSOCKS() {
|
|
|
|
return mType == kProxyType_SOCKS || mType == kProxyType_SOCKS4 ||
|
|
|
|
mType == kProxyType_SOCKS5;
|
|
|
|
}
|
|
|
|
|
2016-05-19 05:02:57 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|