Qt-interest Archive, May 2007
QHttp and SSL possible bug
Message 1 in thread
Hi,
I am using the 'Qt 4.3.0-snapshot-20070429 Open Source Edition'.
The problem i have run into is that QHttp fails randomly when used
with QSslSocket.
Interresting is that QHttp changes it's state first to
QHttp::Connecting, then to QHttp::Unconnected (here all fails), but
then as nothing happened it changes the state to QHttp::Sending and
all goes to an end as it should (check the debug output).
I was unable to find the cause myself (too weak), but maybe someone
working on the QSslSocket might take a look at it (all works perfectly
with QTcpSocket).
Thank You!
The code (cut some things to shorten):
------------------------------
m_httpClient = new QHttp(this);
m_httpClient->setHost(serverUrl.host(), QHttp::ConnectionModeHttps,
serverUrl.port());
int httpReqNum = m_httpClient->request(reqHead, payload);
------------------------------
Interresting debug output:
-----------------------------
QHttp::bytesAvailable(): 0 bytes
QHttp::bytesAvailable(): 0 bytes
QSslSocket::QSslSocket( QObject(0x0) ), this = 0x8252600
QHttp state changed 0 -> 2
QSslSocket::connectToHostImplementation( "localhost" , 8777 ,
OpenMode( "ReadOnly|WriteOnly" ) )
creating internal plain socket
QSslSocket::_q_stateChangedSlot( QAbstractSocket::HostLookupState )
-------->QHttp state changed 2 -> 0
QHttp::bytesAvailable(): 0 bytes
Bytes: 0
QHttp::bytesAvailable(): 0 bytes
QHttp::read(): read 0 bytes (0 bytes done)
QSslSocket::_q_stateChangedSlot( QAbstractSocket::ConnectingState )
QSslSocket::_q_hostFoundSlot()
state = QAbstractSocket::ConnectingState
QSslSocket::_q_stateChangedSlot( QAbstractSocket::ConnectedState )
QSslSocket::_q_connectedSlot()
state = QAbstractSocket::ConnectedState
peer = "localhost" QHostAddress( "127.0.0.1" ) 8777
local = "localhost" QHostAddress( "127.0.0.1" ) 7404
QHttp state changed 0 -> 3
QSslSocket::writeData( 0x8298ea8 , 110 )
QHttp: write request header 0x825a320:
---{
POST /RPC2 HTTP/1.1
Host: localhost
content-length: 300
content-type: text/xml
}---
QSslSocket::writeData( 0x825db18 , 300 )
QSslSocket::startClientEncryption()
QSslSocket::_q_bytesWrittenSlot( 100 )
QSslSocket::_q_readyReadSlot() - 744 bytes available
QSslSocket::_q_bytesWrittenSlot( 212 )
QSslSocket::_q_readyReadSlot() - 75 bytes available
QSslSocket::_q_bytesWrittenSlot( 437 )
QSslSocket::_q_readyReadSlot() - 90 bytes available
QHttp state changed 3 -> 4
QSslSocket::readData( 0x82644f8 , 16384 ) == 17
QSslSocket::_q_readyReadSlot() - 705 bytes available
QSslSocket::readData( 0x82644f8 , 16384 ) == 35
QSslSocket::readData( 0x82644f8 , 16384 ) == 37
QSslSocket::readData( 0x82644f8 , 16384 ) == 24
QSslSocket::readData( 0x82644f8 , 16384 ) == 21
QSslSocket::readData( 0x82644f8 , 16384 ) == 2
QHttp: read response header:
---{
HTTP/1.0 200 OK
server: BaseHTTP/0.3 Python/2.4.2
date: Mon, 07 May 2007 13:13:46 GMT
content-type: text/xml
content-length: 129
}---
QHttp::bytesAvailable(): 0 bytes
QSslSocket::readData( 0x82644f8 , 16384 ) == 129
QHttp::bytesAvailable(): 0 bytes
QHttp::bytesAvailable(): 129 bytes
QHttp::_q_slotReadyRead(): read 129 bytes (129 bytes done)
QHttp::bytesAvailable(): 129 bytes
QHttp state changed 4 -> 5
QSslSocket::_q_stateChangedSlot( QAbstractSocket::ClosingState )
QSslSocket::_q_stateChangedSlot( QAbstractSocket::UnconnectedState )
QSslSocket::_q_disconnectedSlot()
state = QAbstractSocket::UnconnectedState
QHttp state changed 5 -> 6
QHttp state changed 6 -> 0
------------------------------
Sincerely,
Darjus Loktevic
--
[ signature omitted ]