Changeset 23769 in webkit
- Timestamp:
- Jun 25, 2007 11:20:57 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r23767 r23769 1 2007-06-25 George Staikos <staikos@kde.org> 2 3 Reviewed by Zack. 4 5 Start to add proxy and SSL support to WebKitQt. Proxying works. 6 7 * platform/network/ResourceHandleInternal.h: 8 (WebCore::ResourceHandleInternal::ResourceHandleInternal): 9 * platform/network/qt/ResourceHandleQt.cpp: 10 (WebCore::ResourceHandle::start): 11 1 12 2007-06-25 Alp Toker <alp.toker@collabora.co.uk> 2 13 -
trunk/WebCore/platform/network/ResourceHandleInternal.h
r21885 r23769 46 46 47 47 #if PLATFORM(QT) 48 class QWebFrame; 48 49 class QWebNetworkJob; 49 50 #endif … … 98 99 #if PLATFORM(QT) 99 100 , m_job(0) 101 , m_frame(0) 100 102 #endif 101 103 #if PLATFORM(MAC) … … 150 152 #if PLATFORM(QT) 151 153 QWebNetworkJob *m_job; 154 QWebFrame *m_frame; 152 155 #endif 153 156 #if PLATFORM(MAC) -
trunk/WebCore/platform/network/qt/ResourceHandleQt.cpp
r21827 r23769 29 29 #include "config.h" 30 30 31 #include <QRegExp>32 33 31 #include "Frame.h" 34 32 #include "DocLoader.h" … … 39 37 #include "qwebpage_p.h" 40 38 #include "ChromeClientQt.h" 39 #include "FrameLoaderClientQt.h" 41 40 #include "Page.h" 42 41 … … 72 71 } 73 72 74 ChromeClientQt *client = static_cast<ChromeClientQt *>(page->chrome()->client()); 75 QWebPagePrivate *webPage = client->m_webPage->d; 76 return QWebNetworkManager::self()->add(this, webPage->networkInterface); 73 getInternal()->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame(); 74 return QWebNetworkManager::self()->add(this, getInternal()->m_frame->page()->d->networkInterface); 77 75 } 78 76 -
trunk/WebKitQt/Api/qwebnetworkinterface.cpp
r23588 r23769 22 22 */ 23 23 #include <qglobal.h> 24 #include "qwebframe.h" 24 25 #include "qwebnetworkinterface.h" 25 26 #include "qwebnetworkinterface_p.h" 26 27 #include "qwebobjectpluginconnector.h" 28 #include "qwebpage.h" 27 29 #include <qdebug.h> 28 30 #include <qfile.h> 31 #include <qnetworkproxy.h> 29 32 #include <qurl.h> 30 33 … … 100 103 url = u; 101 104 int port = url.port(); 102 if (port > 0 && port != 80) 105 const QString scheme = u.scheme(); 106 if (port > 0 && (port != 80 || scheme != "http") && (port != 443 || scheme != "https")) 103 107 httpHeader.setValue(QLatin1String("Host"), url.host() + QLatin1Char(':') + QString::number(port)); 104 108 else … … 335 339 { 336 340 return d->interface; 341 } 342 343 /*! 344 Returns the network interface that is associated with this job. 345 */ 346 QWebFrame *QWebNetworkJob::frame() const 347 { 348 if (d->resourceHandle) { 349 ResourceHandleInternal *rhi = d->resourceHandle->getInternal(); 350 if (rhi) { 351 return rhi->m_frame; 352 } 353 } 354 return 0; 337 355 } 338 356 … … 791 809 connect(connection[i].http, SIGNAL(requestFinished(int, bool)), 792 810 this, SLOT(onRequestFinished(int, bool))); 811 connect(connection[i].http, SIGNAL(done(bool)), 812 this, SLOT(onDone(bool))); 793 813 connect(connection[i].http, SIGNAL(stateChanged(int)), 794 814 this, SLOT(onStateChanged(int))); 815 connect(connection[i].http, SIGNAL(authenticationRequired(const QString&, quint16, QAuthenticator*)), 816 this, SLOT(onAuthenticationRequired(const QString&, quint16, QAuthenticator*))); 817 connect(connection[i].http, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)), 818 this, SLOT(onProxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); 819 connect(connection[i].http, SIGNAL(sslErrors(const QList<QSslError>&)), 820 this, SLOT(onSslErrors(const QList<QSslError>&))); 795 821 } 796 822 } … … 831 857 832 858 QHttp *http = connection[c].http; 859 860 connection[c].current = job; 861 http->setProxy(job->frame()->page()->networkProxy()); 862 connection[c].proxyDone = false; 863 833 864 QByteArray postData = job->postData(); 834 865 if (!postData.isEmpty()) … … 836 867 else 837 868 http->request(job->httpHeader()); 838 connection[c].current = job;839 869 840 870 DEBUG() << "WebCoreHttp::scheduleNextRequest: using connection" << c; … … 880 910 } 881 911 882 void WebCoreHttp::onRequestFinished(int , bool error)912 void WebCoreHttp::onRequestFinished(int id, bool error) 883 913 { 884 914 int c = getConnection(); 915 if (!connection[c].proxyDone) { 916 connection[c].proxyDone = true; 917 return; 918 } 885 919 QWebNetworkJob *req = connection[c].current; 886 920 if (!req) { … … 888 922 return; 889 923 } 924 890 925 QHttp *http = connection[c].http; 891 926 DEBUG() << "WebCoreHttp::slotFinished connection=" << c << error << req; 892 893 927 if (error) 894 928 DEBUG() << " error: " << http->errorString(); … … 901 935 } 902 936 emit req->networkInterface()->finished(req, error ? 1 : 0); 937 } 938 939 void WebCoreHttp::onDone(bool error) 940 { 941 int c = getConnection(); 942 QWebNetworkJob *req = connection[c].current; 943 if (!req) { 944 scheduleNextRequest(); 945 return; 946 } 947 948 DEBUG() << "WebCoreHttp::DONE connection=" << c << error << req; 949 QHttp *http = connection[c].http; 950 951 if (error) 952 DEBUG() << " error: " << http->errorString(); 903 953 904 954 connection[c].current = 0; … … 937 987 } 938 988 989 void WebCoreHttp::onSslErrors(const QList<QSslError>& errors) 990 { 991 int c = getConnection(); 992 QWebNetworkJob *req = connection[c].current; 993 if (!req) { 994 return; 995 } 996 997 qDebug() << "SSL ERRORS"; 998 //emit req->frame()->page()->sslErrors(req->frame(), errors); 999 } 1000 1001 void WebCoreHttp::onAuthenticationRequired(const QString& hostname, quint16 port, QAuthenticator *auth) 1002 { 1003 int c = getConnection(); 1004 QWebNetworkJob *req = connection[c].current; 1005 if (!req) { 1006 return; 1007 } 1008 1009 qDebug() << "AUTH REQUIRED" << hostname << port << auth; 1010 //emit req->frame()->page()->authenticate(req->frame(), hostname, port, auth); 1011 } 1012 1013 void WebCoreHttp::onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator *auth) 1014 { 1015 } 1016 939 1017 HostInfo::HostInfo(const QUrl& url) 940 1018 : protocol(url.scheme()) -
trunk/WebKitQt/Api/qwebnetworkinterface.h
r23500 r23769 30 30 #include <qwebkitglobal.h> 31 31 32 class QWebFrame; 32 33 class QWebNetworkJobPrivate; 33 34 class QWebNetworkInterface; … … 97 98 QWebNetworkInterface *networkInterface() const; 98 99 100 QWebFrame *frame() const; 101 99 102 private: 100 103 QWebNetworkJob(); -
trunk/WebKitQt/Api/qwebnetworkinterface_p.h
r23490 r23769 130 130 void onReadyRead(); 131 131 void onRequestFinished(int, bool); 132 void onDone(bool); 132 133 void onStateChanged(int); 134 void onSslErrors(const QList<QSslError>&); 135 void onAuthenticationRequired(const QString& hostname, quint16 port, QAuthenticator *); 136 void onProxyAuthenticationRequired(const QNetworkProxy& proxy, QAuthenticator *); 133 137 134 138 void scheduleNextRequest(); … … 143 147 QHttp *http; 144 148 QWebNetworkJob *current; 149 bool proxyDone; 145 150 }; 146 151 HttpConnection connection[2]; -
trunk/WebKitQt/Api/qwebpage.cpp
r23733 r23769 55 55 #include <QInputDialog> 56 56 #include <QMessageBox> 57 #include <QNetworkProxy> 57 58 #include <QUndoStack> 58 59 #include <QUrl> … … 449 450 } 450 451 452 void QWebPage::setNetworkProxy(const QNetworkProxy& proxy) 453 { 454 d->networkProxy = proxy; 455 } 456 457 QNetworkProxy QWebPage::networkProxy() const 458 { 459 return d->networkProxy; 460 } 461 -
trunk/WebKitQt/Api/qwebpage.h
r23691 r23769 30 30 31 31 #include <qwidget.h> 32 class Q WebFrame;32 class QNetworkProxy; 33 33 class QUndoStack; 34 34 class QUrl; 35 class QWebFrame; 35 36 class QWebNetworkRequest; 36 37 … … 85 86 86 87 QPixmap icon() const; 88 89 void setNetworkProxy(const QNetworkProxy& proxy); 90 QNetworkProxy networkProxy() const; 87 91 88 92 public slots: -
trunk/WebKitQt/Api/qwebpage_p.h
r23494 r23769 23 23 #define QWEBPAGE_P_H 24 24 25 #include <qnetworkproxy.h> 25 26 #include <qpointer.h> 26 27 … … 63 64 bool insideOpenCall; 64 65 QWebPage::NavigationRequestResponse navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request); 66 QNetworkProxy networkProxy; 65 67 }; 66 68 -
trunk/WebKitQt/ChangeLog
r23733 r23769 1 2007-06-25 George Staikos <staikos@kde.org> 2 3 Reviewed by Zack. 4 5 Start to add proxy and SSL support to WebKit Qt. Proxy works 6 unauthenticated. Added hooks to be able to add authentication. 7 Also fixes some network errors. 8 9 * Api/qwebnetworkinterface.cpp: 10 (QWebNetworkRequestPrivate::setURL): 11 (QWebNetworkJob::frame): 12 (WebCoreHttp::WebCoreHttp): 13 (WebCoreHttp::scheduleNextRequest): 14 (WebCoreHttp::onRequestFinished): 15 (WebCoreHttp::onDone): 16 (WebCoreHttp::onSslErrors): 17 (WebCoreHttp::onAuthenticationRequired): 18 (WebCoreHttp::onProxyAuthenticationRequired): 19 * Api/qwebnetworkinterface.h: 20 * Api/qwebnetworkinterface_p.h: 21 * Api/qwebpage.cpp: 22 (QWebPage::setNetworkProxy): 23 (QWebPage::networkProxy): 24 * Api/qwebpage.h: 25 * Api/qwebpage_p.h: 26 1 27 2007-06-21 Adam Treat <adam@staikos.net> 2 28
Note: See TracChangeset
for help on using the changeset viewer.