actualizado el servidor HTTP

This commit is contained in:
Luis Ángel San Martín
2013-06-13 13:53:34 +02:00
parent d4ef318190
commit dee244455e
6 changed files with 25 additions and 6 deletions

View File

@ -56,14 +56,20 @@ void HttpResponse::writeHeaders() {
sentHeaders=true;
}
void HttpResponse::writeToSocket(QByteArray data) {
bool HttpResponse::writeToSocket(QByteArray data) {
int remaining=data.size();
char* ptr=data.data();
while (socket->isOpen() && remaining>0) {
int written=socket->write(data);
// Wait until the previous buffer content is written out, otherwise it could become very large
socket->waitForBytesWritten(-1);
int written=socket->write(ptr,remaining);
if (written==-1) {
return false;
}
ptr+=written;
remaining-=written;
}
return true;
}
void HttpResponse::write(QByteArray data, bool lastPart) {