MCPcopy Index your code
hub / github.com/crosspoint-reader/crosspoint-reader / handleGet

Method handleGet

src/network/WebDAVHandler.cpp:300–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298// ── GET ──────────────────────────────────────────────────────────────────────
299
300void WebDAVHandler::handleGet(WebServer& s) {
301 String path = getRequestPath(s);
302 LOG_DBG("DAV", "GET %s", path.c_str());
303
304 if (isProtectedPath(path)) {
305 s.send(403, "text/plain", "Forbidden");
306 return;
307 }
308
309 if (!Storage.exists(path.c_str())) {
310 s.send(404, "text/plain", "Not Found");
311 return;
312 }
313
314 HalFile file = Storage.open(path.c_str());
315 if (!file) {
316 s.send(500, "text/plain", "Failed to open file");
317 return;
318 }
319 if (file.isDirectory()) {
320 file.close();
321 // For directories, return a PROPFIND-like response or redirect
322 s.send(405, "text/plain", "Method Not Allowed");
323 return;
324 }
325
326 String contentType = getMimeType(path);
327 s.setContentLength(file.size());
328 s.send(200, contentType.c_str(), "");
329
330 NetworkClient client = s.client();
331 client.write(file);
332 file.close();
333}
334
335// ── HEAD ─────────────────────────────────────────────────────────────────────
336

Callers

nothing calls this directly

Calls 6

existsMethod · 0.80
isDirectoryMethod · 0.80
openMethod · 0.45
closeMethod · 0.45
sizeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected