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

Function onFile

samples/Basic_WebSkeletonApp/app/webserver.cpp:157–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157int onFile(HttpServerConnection& connection, HttpRequest& request, HttpResponse& response)
158{
159 String file = request.uri.getRelativePath();
160
161 if(file[0] == '.') {
162 response.code = HTTP_STATUS_FORBIDDEN;
163 } else {
164 // response.setCache(86400, true); // It's important to use cache for better performance.
165 sendFile(file, connection);
166 }
167
168 return 0;
169}
170
171void onAjaxGetState(HttpRequest& request, HttpResponse& response)
172{

Callers

nothing calls this directly

Calls 2

sendFileFunction · 0.85
getRelativePathMethod · 0.80

Tested by

no test coverage detected