nitroshare/qhttpengine

readChannelFinished() emitted twice if request has Content-Length header

Closed this issue · 0 comments

The QHttpEngine::Socket::readChannelFinished() signal is emitted twice if the following occurs:

  1. The Content-Length header is set on the request, causing the signal to be emitted when requestDataRead is equal or greater than requestDataTotal (see here)

  2. The physical transport (QTcpSocket) emits the readChannelFinished() signal, which is connected to QHttpEngine::Socket::readChannelFinished(), causing it to be emitted a second time (see here)

The correct behavior would be for the transport signal to be connected to a private slot that emits QHttpEngine::Socket::readChannelFinished() only if requestDataTotal is equal to -1.