MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / sendReplyToClient

Method sendReplyToClient

sources/webserver/QtHttpClientWrapper.cpp:351–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351QtHttpClientWrapper::ParsingStatus QtHttpClientWrapper::sendReplyToClient(QtHttpReply* reply)
352{
353 if (reply != Q_NULLPTR)
354 {
355 if (!reply->useChunked())
356 {
357 //reply->appendRawData (CRLF);
358 // send all headers and all data in one shot
359 reply->requestSendHeaders();
360 reply->requestSendData();
361 }
362 else
363 {
364 // last chunk
365 m_sockClient->write("0" % CRLF % CRLF);
366 m_sockClient->flush();
367 }
368
369 if (m_currentRequest != Q_NULLPTR)
370 {
371 static const QByteArray& CLOSE = QByteArrayLiteral("close");
372
373 if (m_currentRequest->getHeader(QtHttpHeader::Connection).toLower() == CLOSE)
374 {
375 // must close connection after this request
376 m_sockClient->close();
377 }
378
379 m_currentRequest->deleteLater();
380 m_currentRequest = Q_NULLPTR;
381 }
382 }
383
384 return AwaitingRequest;
385}
386

Callers

nothing calls this directly

Calls 4

useChunkedMethod · 0.80
writeMethod · 0.45
getHeaderMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected