OTA update
This commit is contained in:
@@ -114,6 +114,9 @@ std::function<void(httpd_req_t *)> webdavHandler(const char *uriPrefix,
|
||||
String uri = String(req->uri).substring(strlen(uriPrefix));
|
||||
constexpr size_t WEBDAV_BUFF_LEN = 1024 * 256;
|
||||
static char *webdavBuffer = (char *)heap_caps_malloc(WEBDAV_BUFF_LEN, MALLOC_CAP_SPIRAM);
|
||||
|
||||
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
|
||||
|
||||
switch (req->method)
|
||||
{
|
||||
case HTTP_GET:
|
||||
@@ -139,7 +142,7 @@ std::function<void(httpd_req_t *)> webdavHandler(const char *uriPrefix,
|
||||
httpd_resp_send(req, webdavBuffer, bytesWritten);
|
||||
break;
|
||||
}
|
||||
case HTTP_DELETE:
|
||||
case HTTP_DELETE:
|
||||
{
|
||||
httpd_resp_set_hdr(req, "Content-Type", "text/plain");
|
||||
|
||||
@@ -149,7 +152,16 @@ std::function<void(httpd_req_t *)> webdavHandler(const char *uriPrefix,
|
||||
httpd_resp_send_404(req);
|
||||
break;
|
||||
}
|
||||
case HTTP_OPTIONS:
|
||||
{
|
||||
Serial.println("Options request");
|
||||
httpd_resp_set_status(req, "204 No Content");
|
||||
httpd_resp_set_hdr(req, "Access-Control-Allow-Methods", "GET, PROPFIND, DELETE, OPTIONS");
|
||||
httpd_resp_send(req, "", 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Serial.printf("Sending 404 %d uri %s\n", req->method, req->uri);
|
||||
httpd_resp_send_404(req);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user