MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / sendRangeNotSatisfiable

Method sendRangeNotSatisfiable

Libraries/Http/HttpAsyncFileServer.cpp:776–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776Result HttpAsyncFileServer::Internal::sendRangeNotSatisfiable(HttpResponse& response, size_t fileSize)
777{
778 char contentRangeData[64];
779 size_t contentRangeLength = 0;
780 SC_TRY(formatUnsatisfiedContentRange(fileSize, contentRangeData, sizeof(contentRangeData), contentRangeLength));
781 StringSpan contentRange = {{contentRangeData, contentRangeLength}, false, StringEncoding::Ascii};
782
783 SC_TRY(response.startResponse(416));
784 SC_TRY(writeGMTHeaderTime("Date", response, getCurrentTimeMilliseconds()));
785 SC_TRY(response.addHeader("Content-Range", contentRange));
786 SC_TRY(response.addHeader("Accept-Ranges", "bytes"));
787 SC_TRY(response.addHeader("Server", "SC"));
788 SC_TRY(response.addContentLength(0));
789 SC_TRY(response.sendHeaders());
790 return response.end();
791}
792
793int64_t HttpAsyncFileServer::Internal::getCurrentTimeMilliseconds()
794{

Callers

nothing calls this directly

Calls 5

startResponseMethod · 0.80
addContentLengthMethod · 0.80
sendHeadersMethod · 0.80
addHeaderMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected