MCPcopy Create free account
hub / github.com/SmingHub/Sming / onFile

Function onFile

samples/WebcamServer/app/application.cpp:27–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27void onFile(HttpRequest& request, HttpResponse& response)
28{
29 String file = request.uri.getRelativePath();
30
31 if(file[0] == '.') {
32 response.code = HTTP_STATUS_FORBIDDEN;
33 } else {
34 response.setCache(86400, true); // It's important to use cache for better performance.
35 response.sendFile(file);
36 }
37}
38
39MultipartStream::BodyPart snapshotProducer()
40{

Callers

nothing calls this directly

Calls 3

getRelativePathMethod · 0.80
setCacheMethod · 0.80
sendFileMethod · 0.45

Tested by

no test coverage detected