1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsProxyInfo.h"
13 // Yes, we support QI to nsProxyInfo
14 NS_IMPL_ISUPPORTS(nsProxyInfo
, nsProxyInfo
, nsIProxyInfo
)
17 nsProxyInfo::GetHost(nsACString
&result
) {
23 nsProxyInfo::GetPort(int32_t *result
) {
29 nsProxyInfo::GetType(nsACString
&result
) {
35 nsProxyInfo::GetFlags(uint32_t *result
) {
41 nsProxyInfo::GetResolveFlags(uint32_t *result
) {
42 *result
= mResolveFlags
;
47 nsProxyInfo::GetUsername(nsACString
&result
) {
53 nsProxyInfo::GetPassword(nsACString
&result
) {
59 nsProxyInfo::GetFailoverTimeout(uint32_t *result
) {
65 nsProxyInfo::GetFailoverProxy(nsIProxyInfo
**result
) {
66 NS_IF_ADDREF(*result
= mNext
);
71 nsProxyInfo::SetFailoverProxy(nsIProxyInfo
*proxy
) {
72 nsCOMPtr
<nsProxyInfo
> pi
= do_QueryInterface(proxy
);
79 // These pointers are declared in nsProtocolProxyService.cpp and
80 // comparison of mType by string pointer is valid within necko
81 extern const char kProxyType_HTTP
[];
82 extern const char kProxyType_HTTPS
[];
83 extern const char kProxyType_SOCKS
[];
84 extern const char kProxyType_SOCKS4
[];
85 extern const char kProxyType_SOCKS5
[];
86 extern const char kProxyType_DIRECT
[];
88 bool nsProxyInfo::IsDirect() {
89 if (!mType
) return true;
90 return mType
== kProxyType_DIRECT
;
93 bool nsProxyInfo::IsHTTP() { return mType
== kProxyType_HTTP
; }
95 bool nsProxyInfo::IsHTTPS() { return mType
== kProxyType_HTTPS
; }
97 bool nsProxyInfo::IsSOCKS() {
98 return mType
== kProxyType_SOCKS
|| mType
== kProxyType_SOCKS4
||
99 mType
== kProxyType_SOCKS5
;
103 } // namespace mozilla