MCPcopy Create free account
hub / github.com/Duet3D/RepRapFirmware / SendFileInfo

Method SendFileInfo

src/Networking/HttpResponder.cpp:735–765  ·  view source on GitHub ↗

Called to process a FileInfo request, which may take several calls Return true if complete

Source from the content-addressed store, hash-verified

733// Called to process a FileInfo request, which may take several calls
734// Return true if complete
735bool HttpResponder::SendFileInfo(bool quitEarly) noexcept
736{
737 OutputBuffer *_ecv_null jsonResponse = nullptr;
738 bool gotFileInfo = (reprap.GetFileInfoResponse(nullptr, filenameBeingProcessed.c_str(), jsonResponse, quitEarly) != GCodeResult::notFinished);
739 if (gotFileInfo)
740 {
741 // Got it - send the response now
742 outBuf->copy( "HTTP/1.1 200 OK\r\n"
743 "Cache-Control: no-cache, no-store, must-revalidate\r\n"
744 "Pragma: no-cache\r\n"
745 "Expires: 0\r\n"
746 "Content-Type: application/json\r\n"
747 );
748 outBuf->catf("Content-Length: %u\r\n", (jsonResponse != nullptr) ? jsonResponse->Length() : 0);
749 AddCorsHeader();
750 outBuf->cat("Connection: close\r\n\r\n");
751 outBuf->Append(jsonResponse);
752 if (outBuf->HadOverflow())
753 {
754 OutputBuffer::ReleaseAll(outBuf);
755 ReportOutputBufferExhaustion(__FILE__, __LINE__);
756 gotFileInfo = false;
757 }
758 else
759 {
760 filenameBeingProcessed.Clear();
761 Commit();
762 }
763 }
764 return gotFileInfo;
765}
766
767// Authenticate the client and return true on success including a new session key if supported
768bool HttpResponder::Authenticate(bool withSessionKey, HttpSessionKey &sessionKey) noexcept

Callers

nothing calls this directly

Calls 8

GetFileInfoResponseMethod · 0.80
copyMethod · 0.80
catfMethod · 0.80
catMethod · 0.80
AppendMethod · 0.80
HadOverflowMethod · 0.80
LengthMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected