KProtocolManager fit for use?

Thiago Macieira thiago at kde.org
Tue Nov 27 18:53:57 GMT 2007


Em Monday 26 November 2007 20:18:16 Andreas Hartmetz escreveu:
> As I'm writing a class called KTcpSocket to resurrect and clean up SSL
> support, I had the not-so-crazy idea to make it optionally (but by default)
> obey proxy setting from KProtocolManager:

When I prototyped the KTcpSocket class for you, I had there:

    void connectToHost(const QUrl &url, OpenMode mode = ReadWrite);
    void connectToHost(const QString &protocol, const QString &host, quint16 
port,
                       OpenMode mode = ReadWrite);

Note that it differs from QAbstractSocket (QTcpSocket) by the addition of the 
extra parameter "protocol" (the triad protocol + host + port is perfectly 
represented in a URL, hence the overload -- which, come to think of it, 
should be a KUrl).

Anyways, the extra parameter's only purpose is to support proxying. I 
conceived it so that multi-protocol applications like Kopete could support 
different proxies depending on the connection. At the same time, we want to 
support the vast majority of the cases: HTTP has one proxy, everything else 
uses another.

My crazy ideas go as far as using JavaScript to decide what proxy to be 
used -- à la WPAD/PAC.

Anyways, while the front-end is there, the backend isn't. KSocketFactory has a 
method that returns a QNetworkProxy for a given protocol+host+port, but is 
currently just a placeholder for the future. When KSocketFactory had a 
purpose, such a method could stay there, but now I don't mind if it's the 
same method as KProtocolManager.

In any case, I urge you to:
1) not bother with this for 4.0. Let's do it calmly for 4.1. I am sure that 
KProtocolManager *right* *now* isn't suitable for your needs. It's only 
useful for web browsing (http & ftp URLs).

2) not add the ProxyPolicy argument as part of the connectToHost function. 
Instead, add a setter/getter.

Actually, for #2, there's another use-case: KGet. The idea is that it uses 
http, just like Konqueror, but the user may want to have specific proxy 
settings for large downloads. 

Being able to call setProxy() would be interesting (with 
QNetworkProxy::DefaultProxy meaning the configuration/script-based 
detection). KGet would just have to know its own proxies outside of the KDE 
configuration.

Finally, proxy configuration is another subject of standardisation at 
freedesktop.org-level.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071127/ac472a80/attachment.sig>


More information about the kde-core-devel mailing list