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

Function onFile

samples/HttpServer_Bootstrap/app/application.cpp:43–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void onFile(HttpRequest& request, HttpResponse& response)
44{
45 String file = request.uri.getRelativePath();
46
47 if(file[0] == '.')
48 response.code = HTTP_STATUS_FORBIDDEN;
49 else {
50 response.setCache(86400, true); // It's important to use cache for better performance.
51 response.sendFile(file);
52 }
53}
54
55void startWebServer()
56{

Callers

nothing calls this directly

Calls 3

getRelativePathMethod · 0.80
setCacheMethod · 0.80
sendFileMethod · 0.45

Tested by

no test coverage detected