equal
deleted
inserted
replaced
40 ****************************************************************************/ |
40 ****************************************************************************/ |
41 |
41 |
42 #include "qhttpsocketengine_p.h" |
42 #include "qhttpsocketengine_p.h" |
43 #include "qtcpsocket.h" |
43 #include "qtcpsocket.h" |
44 #include "qhostaddress.h" |
44 #include "qhostaddress.h" |
45 #include "qdatetime.h" |
|
46 #include "qurl.h" |
45 #include "qurl.h" |
47 #include "qhttp.h" |
46 #include "qhttp.h" |
|
47 #include "qelapsedtimer.h" |
48 |
48 |
49 #if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) |
49 #if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP) |
50 #include <qdebug.h> |
50 #include <qdebug.h> |
51 |
51 |
52 QT_BEGIN_NAMESPACE |
52 QT_BEGIN_NAMESPACE |
317 Q_D(const QHttpSocketEngine); |
317 Q_D(const QHttpSocketEngine); |
318 |
318 |
319 if (!d->socket || d->socket->state() == QAbstractSocket::UnconnectedState) |
319 if (!d->socket || d->socket->state() == QAbstractSocket::UnconnectedState) |
320 return false; |
320 return false; |
321 |
321 |
322 QTime stopWatch; |
322 QElapsedTimer stopWatch; |
323 stopWatch.start(); |
323 stopWatch.start(); |
324 |
324 |
325 // Wait for more data if nothing is available. |
325 // Wait for more data if nothing is available. |
326 if (!d->socket->bytesAvailable()) { |
326 if (!d->socket->bytesAvailable()) { |
327 if (!d->socket->waitForReadyRead(qt_timeout_value(msecs, stopWatch.elapsed()))) { |
327 if (!d->socket->waitForReadyRead(qt_timeout_value(msecs, stopWatch.elapsed()))) { |
364 } |
364 } |
365 } |
365 } |
366 return true; |
366 return true; |
367 } |
367 } |
368 |
368 |
369 QTime stopWatch; |
369 QElapsedTimer stopWatch; |
370 stopWatch.start(); |
370 stopWatch.start(); |
371 |
371 |
372 // If we're not connected yet, wait until we are, and until bytes have |
372 // If we're not connected yet, wait until we are, and until bytes have |
373 // been received (i.e., the socket has connected, we have sent the |
373 // been received (i.e., the socket has connected, we have sent the |
374 // greeting, and then received the response). |
374 // greeting, and then received the response). |