azadkuh / qhttp

a light-weight and asynchronous HTTP library (both server & client) in Qt5 and c++14
MIT License
484 stars 158 forks source link

QHttpRequest returns isSuccessful() == true even if the sending part has been interrupted #30

Open HappySeaFox opened 7 years ago

HappySeaFox commented 7 years ago

Hi. I'd like to implement a HTTP server supporting modern POST multipart/form-data requests. I am lucky and QHTTP supports such requests. However if use curl to send a file to my server like that:

curl "http://127.0.0.1:5000/video.mp4" -F "file=@H:\video.mp4" -v

and then immediately Ctrl+C, I'll get an end() signal:

connect(m_request, &qhttp::server::QHttpRequest::end, this, &Connection::end, Qt::QueuedConnection);
....
void Connection::end()
{
    qDebug("Transfer finished successfully: %s", m_request->isSuccessful() ? "yes" : "no");
}

Is there a way to determine that the POST request has been interrupted?