Does WebKit have http connecting module?



  • hi,

    I am a beginner of WebKit. It looks like WebKit doesn't have an API about setting proxy.

    Previously when I was using Molliza sdk, I can set proxy by:
    @
    nsCOMPtr<nsIProtocolProxyService> proxyService =
    do_GetService("@mozilla.org/network/protocol-proxy-service;1", &nrv);
    @
    I find an interesting thing: When you want to set proxy in Chrome or Safari, actually you are setting system level proxy. I guess the proxy module in Chrome and Safari is not related to WebKit module, but not sure.

    I also find in QT, you can set proxy in application by :
    @
    #include <QNetworkProxy>
    ……
    QNetworkProxy * proxy = new QNetworkProxy();
    proxy->setHostName("localhost");
    proxy->setPort(8888);
    proxy->setType(QNetworkProxy::HttpProxy);
    QNetworkProxy::setApplicationProxy(*proxy);
    @
    Many QtWebKit based open source browser implement the proxy in this way. This module looks not related to QtWebKit, but belongs to QtCore.So does this mean WebKit is just for rendering, and it doesn't have module for http conecting? I previously thought WebKit should have every module like Molliza Gecko. Browsers based on WebKit will just need to implement UI. But the thing doesn't look like this..

    Thanks for any help!!

    Cheers,
    Yanke

    Edit: Added code formatting. Please use @ tags around any code sections; Andre



  • I don't know much about how Webkit is used outside of Qt, but I do know that the networking stack implemented in Qt is also used outside of webkit. That does indeed mean that the kind of API you show does not exist in the Qt Webkit module. What's more, the kind of API you show does not match the Qt API's at all. All the Qt classes dealing with webkit have been wrapped in Qt-style objects with an API that matches how the rest of Qt is build. That makes it easier to work with for Qt developers, but perhaps less so for people who are used to dealing with webkit directly.



  • hi, Andre,

    Thank you for your answer!

    I don't quite understand "What’s more, the kind of API you show does not match the Qt API’s at all".

    I guess <QNetworkProxy> belongs to Qt API..

    For my understanding, WebKit has a Qt port (including classes like QWebPage,QWebFrame,etc), which provide interaction between WebKit and Qt APIs

    I see many QtWebKit based browsers use QNetworkProxy and QNetworkRequest for http request, which looks like they just utilize WebKit rendering functions, but use http connection and proxy setting functions from Qt.

    I just guess maybe WebKit has its own Network module(maybe just for some http setting , but not connecting) which isn't used by Qt..

    Thanks for any help!!



  • [quote author="huyanke" date="1305141230"]hi, Andre,

    Thank you for your answer!

    I don't quite understand "What’s more, the kind of API you show does not match the Qt API’s at all".[/quote]
    I was talking about this code:
    @
    nsCOMPtr<nsIProtocolProxyService> proxyService =
    do_GetService("@mozilla.org/network/protocol-proxy-service;1", &nrv);
    @



  • Andre's comment about non-Qt stuff was related to your first snippet.

    WebKit does not have its own network stack. On the Mac it's very likely that it uses the native methods of Carbon/Cocoa.

    The Qt port of Webkit uses the Qt Networking module (QNetworkAccessManager and friends). So, yes, QtWebkit uses QtNetwork classes for the network access.

    We do not understand the rationale behind your question (just like in your "other thread":https://developer.qt.nokia.com/forums/viewthread/5826/).



  • hi, Volker,

    Thank you for your help!

    My start point is WebKit is used in many popular browsers like Safari, Chrome, android, and also QtWebKit based browsers like Arora, QtWeb,etc.

    An interesting is that when you are setting a proxy in Safrari or Chome, it makes a system proxy setting, meaning other browsers will also use this setting. But when you are setting a proxy in Arora , or QtWeb, it 's a process level setting.

    Thank you for clarifying a lot, and now I know WebKit doesn't implement http request itself, and QtWebKit make the setting proxy function through QNetwork module.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.