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

Function onFile

samples/MeteoControl/app/webserver.cpp:63–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void onFile(HttpRequest& request, HttpResponse& response)
64{
65 String file = request.uri.getRelativePath();
66
67 if(file[0] == '.')
68 response.code = HTTP_STATUS_FORBIDDEN;
69 else {
70 response.setCache(86400, true); // It's important to use cache for better performance.
71 response.sendFile(file);
72 }
73}
74
75/// API ///
76

Callers

nothing calls this directly

Calls 3

getRelativePathMethod · 0.80
setCacheMethod · 0.80
sendFileMethod · 0.45

Tested by

no test coverage detected