2 * Copyright (C) 2003,2005 Thiago Macieira <thiago@kde.org>
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef KHTTPPROXYSOCKETDEVICE_H
26 #define KHTTPPROXYSOCKETDEVICE_H
28 #include "k3socketdevice.h"
32 class KHttpProxySocketDevicePrivate
;
35 * @class KHttpProxySocketDevice k3httpproxysocketdevice.h k3httproxysocketdevice.h
36 * @brief The low-level backend for HTTP proxying.
38 * This class derives from KSocketDevice and implements the necessary
39 * calls to make a connection through an HTTP proxy.
41 * @author Thiago Macieira <thiago@kde.org>
42 * @deprecated Use KSocketFactory or KLocalSocket instead
44 class KDECORE_EXPORT KHttpProxySocketDevice
: public KSocketDevice
50 KHttpProxySocketDevice(const KSocketBase
* = 0L);
53 * Constructor with proxy server's address.
55 explicit KHttpProxySocketDevice(const KResolverEntry
& proxy
);
60 virtual ~KHttpProxySocketDevice();
63 * Sets our capabilities.
65 virtual int capabilities() const;
68 * Retrieves the proxy server address.
70 const KResolverEntry
& proxyServer() const;
73 * Sets the proxy server address.
75 void setProxyServer(const KResolverEntry
& proxy
);
83 * Overrides connection.
85 virtual bool connect(const KResolverEntry
& address
);
88 * Name-based connection.
89 * We can tell the HTTP proxy server the full name.
91 virtual bool connect(const QString
& name
, const QString
& service
);
94 * Return the peer address.
96 virtual KSocketAddress
peerAddress() const;
99 * Return the externally visible address. We can't tell what that address is,
100 * so this function always returns an empty object.
102 virtual KSocketAddress
externalAddress() const;
106 * Parses the server reply after sending the connect command.
107 * Returns true on success and false on failure.
109 bool parseServerReply();
110 KHttpProxySocketDevicePrivate
* const d
;
114 * This is the default proxy server to be used.
115 * Applications may want to set this value so that calling setProxyServer()
118 static KResolverEntry defaultProxy
;
121 } // namespace KNetwork