summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkconnectionchannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qhttpnetworkconnectionchannel.cpp')
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 9d78c55..d880f60 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -524,7 +524,7 @@ void QHttpNetworkConnectionChannel::allDone()
handleStatus();
// ### at this point there should be no more data on the socket
// close if server requested
- if (reply->d_func()->connectionCloseEnabled())
+ if (reply->d_func()->isConnectionCloseEnabled())
close();
// queue the finished signal, this is required since we might send new requests from
// slot connected to it. The socket will not fire readyRead signal, if we are already
@@ -539,7 +539,7 @@ void QHttpNetworkConnectionChannel::allDone()
// move next from pipeline to current request
if (!alreadyPipelinedRequests.isEmpty()) {
- if (resendCurrent || reply->d_func()->connectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) {
+ if (resendCurrent || reply->d_func()->isConnectionCloseEnabled() || socket->state() != QAbstractSocket::ConnectedState) {
// move the pipelined ones back to the main queue
requeueCurrentlyPipelinedRequests();
} else {
@@ -584,7 +584,7 @@ void QHttpNetworkConnectionChannel::detectPipeliningSupport()
// check for HTTP/1.1
&& (reply->d_func()->majorVersion == 1 && reply->d_func()->minorVersion == 1)
// check for not having connection close
- && (!reply->d_func()->connectionCloseEnabled())
+ && (!reply->d_func()->isConnectionCloseEnabled())
// check if it is still connected
&& (socket->state() == QAbstractSocket::ConnectedState)
) {
@@ -705,10 +705,30 @@ void QHttpNetworkConnectionChannel::closeAndResendCurrentRequest()
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
}
+bool QHttpNetworkConnectionChannel::isSocketBusy() const
+{
+ return (state & QHttpNetworkConnectionChannel::BusyState);
+}
+
+bool QHttpNetworkConnectionChannel::isSocketWriting() const
+{
+ return (state & QHttpNetworkConnectionChannel::WritingState);
+}
+
+bool QHttpNetworkConnectionChannel::isSocketWaiting() const
+{
+ return (state & QHttpNetworkConnectionChannel::WaitingState);
+}
+
+bool QHttpNetworkConnectionChannel::isSocketReading() const
+{
+ return (state & QHttpNetworkConnectionChannel::ReadingState);
+}
+
//private slots
void QHttpNetworkConnectionChannel::_q_readyRead()
{
- if (connection->d_func()->isSocketWaiting(socket) || connection->d_func()->isSocketReading(socket)) {
+ if (isSocketWaiting() || isSocketReading()) {
state = QHttpNetworkConnectionChannel::ReadingState;
if (reply)
receiveReply();
@@ -719,7 +739,7 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes)
{
Q_UNUSED(bytes);
// bytes have been written to the socket. write even more of them :)
- if (connection->d_func()->isSocketWriting(socket))
+ if (isSocketWriting())
sendRequest();
// otherwise we do nothing
}
@@ -727,7 +747,7 @@ void QHttpNetworkConnectionChannel::_q_bytesWritten(qint64 bytes)
void QHttpNetworkConnectionChannel::_q_disconnected()
{
// read the available data before closing
- if (connection->d_func()->isSocketWaiting(socket) || connection->d_func()->isSocketReading(socket)) {
+ if (isSocketWaiting() || isSocketReading()) {
state = QHttpNetworkConnectionChannel::ReadingState;
if (reply)
receiveReply();