src/network/access/qhttpnetworkconnectionchannel.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
child 18 2f34d5167611
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    88                      Qt::DirectConnection);
    88                      Qt::DirectConnection);
    89     QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
    89     QObject::connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
    90                      this, SLOT(_q_error(QAbstractSocket::SocketError)),
    90                      this, SLOT(_q_error(QAbstractSocket::SocketError)),
    91                      Qt::DirectConnection);
    91                      Qt::DirectConnection);
    92 #ifndef QT_NO_NETWORKPROXY
    92 #ifndef QT_NO_NETWORKPROXY
    93     QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
    93     QObject::connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
    94                      this, SLOT(_q_proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
    94                      this, SLOT(_q_proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
    95                      Qt::DirectConnection);
    95                      Qt::DirectConnection);
    96 #endif
    96 #endif
    97 
    97 
    98 #ifndef QT_NO_OPENSSL
    98 #ifndef QT_NO_OPENSSL
    99     QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
    99     QSslSocket *sslSocket = qobject_cast<QSslSocket*>(socket);
   100     if (sslSocket) {
   100     if (sslSocket) {
   101         // won't be a sslSocket if encrypt is false
   101         // won't be a sslSocket if encrypt is false
   102         QObject::connect(sslSocket, SIGNAL(encrypted()),
   102         QObject::connect(sslSocket, SIGNAL(encrypted()),
   103                          this, SLOT(_q_encrypted()),
   103                          this, SLOT(_q_encrypted()),
   104                          Qt::DirectConnection);
   104                          Qt::DirectConnection);
   105         QObject::connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError>&)),
   105         QObject::connect(sslSocket, SIGNAL(sslErrors(QList<QSslError>)),
   106                          this, SLOT(_q_sslErrors(const QList<QSslError>&)),
   106                          this, SLOT(_q_sslErrors(QList<QSslError>)),
   107                          Qt::DirectConnection);
   107                          Qt::DirectConnection);
   108         QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)),
   108         QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)),
   109                          this, SLOT(_q_encryptedBytesWritten(qint64)),
   109                          this, SLOT(_q_encryptedBytesWritten(qint64)),
   110                          Qt::DirectConnection);
   110                          Qt::DirectConnection);
   111     }
   111     }
   772 
   772 
   773 void QHttpNetworkConnectionChannel::_q_connected()
   773 void QHttpNetworkConnectionChannel::_q_connected()
   774 {
   774 {
   775     // improve performance since we get the request sent by the kernel ASAP
   775     // improve performance since we get the request sent by the kernel ASAP
   776     socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
   776     socket->setSocketOption(QAbstractSocket::LowDelayOption, 1);
       
   777     // not sure yet if it helps, but it makes sense
       
   778     socket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
   777 
   779 
   778     pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown;
   780     pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningSupportUnknown;
   779 
   781 
   780     // ### FIXME: if the server closes the connection unexpectedly, we shouldn't send the same broken request again!
   782     // ### FIXME: if the server closes the connection unexpectedly, we shouldn't send the same broken request again!
   781     //channels[i].reconnectAttempts = 2;
   783     //channels[i].reconnectAttempts = 2;