MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / handleHead

Method handleHead

src/network/WebDAVHandler.cpp:337–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335// ── HEAD ─────────────────────────────────────────────────────────────────────
336
337void WebDAVHandler::handleHead(WebServer& s) {
338 String path = getRequestPath(s);
339 LOG_DBG("DAV", "HEAD %s", path.c_str());
340
341 if (isProtectedPath(path)) {
342 s.send(403, "text/plain", "");
343 return;
344 }
345
346 if (!Storage.exists(path.c_str())) {
347 s.send(404, "text/plain", "");
348 return;
349 }
350
351 HalFile file = Storage.open(path.c_str());
352 if (!file) {
353 s.send(500, "text/plain", "");
354 return;
355 }
356
357 if (file.isDirectory()) {
358 file.close();
359 s.send(200, "text/html", "");
360 return;
361 }
362
363 String contentType = getMimeType(path);
364 s.setContentLength(file.size());
365 s.send(200, contentType.c_str(), "");
366 file.close();
367}
368
369// ── PUT ──────────────────────────────────────────────────────────────────────
370

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected