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

Method RejectMessage

src/Networking/HttpResponder.cpp:1364–1384  ·  view source on GitHub ↗

Reject the current message

Source from the content-addressed store, hash-verified

1362
1363// Reject the current message
1364void HttpResponder::RejectMessage(const char *_ecv_array response, unsigned int code) noexcept
1365{
1366 if (reprap.Debug(Module::Webserver))
1367 {
1368 GetPlatform().MessageF(UsbMessage, "Webserver: rejecting message with: %u %s\n", code, response);
1369 }
1370
1371 if (outBuf != nullptr || OutputBuffer::Allocate(outBuf))
1372 {
1373 outBuf->printf("HTTP/1.1 %u %s\r\n"
1374 "Connection: close\r\n", code, response);
1375 AddCorsHeader();
1376 outBuf->catf("\r\n%s%s%s", ErrorPagePart1, response, ErrorPagePart2);
1377 Commit();
1378 }
1379 else
1380 {
1381 // No output buffers available. Ideally we would wait for one with timeout. For now we just quit.
1382 responderState = ResponderState::free;
1383 }
1384}
1385
1386#if HAS_MASS_STORAGE
1387

Callers

nothing calls this directly

Calls 4

DebugMethod · 0.80
catfMethod · 0.80
MessageFMethod · 0.45
printfMethod · 0.45

Tested by

no test coverage detected