| 335 | // ── HEAD ───────────────────────────────────────────────────────────────────── |
| 336 | |
| 337 | void 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 |
nothing calls this directly
no test coverage detected