diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-06 00:50:04 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-06 00:50:04 (GMT) |
commit | c628213c5b64b50e914d173d207f4fe64629d5e2 (patch) | |
tree | 6f7929433f52721920828aaad2a593203ba85e59 /src | |
parent | d6da01355fb436a04932131373579938dc4b7d8d (diff) | |
download | Qt-c628213c5b64b50e914d173d207f4fe64629d5e2.zip Qt-c628213c5b64b50e914d173d207f4fe64629d5e2.tar.gz Qt-c628213c5b64b50e914d173d207f4fe64629d5e2.tar.bz2 |
Add QML_XHR_DUMP option
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativexmlhttprequest.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/declarative/qml/qdeclarativexmlhttprequest.cpp b/src/declarative/qml/qdeclarativexmlhttprequest.cpp index b7e1832..94205fe 100644 --- a/src/declarative/qml/qdeclarativexmlhttprequest.cpp +++ b/src/declarative/qml/qdeclarativexmlhttprequest.cpp @@ -46,6 +46,7 @@ #include "private/qdeclarativerefcount_p.h" #include "private/qdeclarativeengine_p.h" #include "private/qdeclarativeexpression_p.h" +#include "qdeclarativeglobal_p.h" #include <QtCore/qobject.h> #include <QtScript/qscriptvalue.h> @@ -94,6 +95,8 @@ QT_BEGIN_NAMESPACE +DEFINE_BOOL_CONFIG_OPTION(xhrDump, QML_XHR_DUMP); + class DocumentImpl; class NodeImpl { @@ -1131,6 +1134,14 @@ void QDeclarativeXMLHttpRequest::requestFromUrl(const QUrl &url) } } + if (xhrDump()) { + qWarning().nospace() << "XMLHttpRequest: " << qPrintable(m_method) << " " << qPrintable(url.toString()); + if (!m_data.isEmpty()) { + qWarning().nospace() << " " + << qPrintable(QString::fromUtf8(m_data)); + } + } + if (m_method == QLatin1String("GET")) m_network = networkAccessManager()->get(request); else if (m_method == QLatin1String("HEAD")) @@ -1264,6 +1275,16 @@ void QDeclarativeXMLHttpRequest::finished() if (cbv.isError()) printError(cbv); } m_responseEntityBody.append(m_network->readAll()); + + if (xhrDump()) { + qWarning().nospace() << "XMLHttpRequest: RESPONSE " << qPrintable(m_url.toString()); + if (!m_responseEntityBody.isEmpty()) { + qWarning().nospace() << " " + << qPrintable(QString::fromUtf8(m_responseEntityBody)); + } + } + + m_data.clear(); destroyNetwork(); if (m_state < Loading) { |