## Summary - Upgrade platform from espressif32 6.12.0 (Arduino Core 2.0.17) to pioarduino 55.03.37 (Arduino Core 3.3.7, ESP-IDF 5.5.2) - Add WebDAV Class 1 server (RFC 4918) - SD card can be mounted as a network drive - I also slightly fixed the SDK and also made a [pull request ](https://github.com/open-x4-epaper/community-sdk/pull/21) First PR #1030 (was closed because the implementation was based on an old version of the libraries) Issue #439 --------- Co-authored-by: Dave Allie <dave@daveallie.com>
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <HalStorage.h>
|
|
#include <WebServer.h>
|
|
|
|
class WebDAVHandler : public RequestHandler {
|
|
public:
|
|
// RequestHandler interface
|
|
bool canHandle(WebServer& server, HTTPMethod method, const String& uri) override;
|
|
bool canRaw(WebServer& server, const String& uri) override;
|
|
void raw(WebServer& server, const String& uri, HTTPRaw& raw) override;
|
|
bool handle(WebServer& server, HTTPMethod method, const String& uri) override;
|
|
|
|
private:
|
|
// PUT streaming state (raw() is called in chunks)
|
|
FsFile _putFile;
|
|
String _putPath;
|
|
bool _putOk = false;
|
|
bool _putExisted = false;
|
|
|
|
// WebDAV method handlers
|
|
void handleOptions(WebServer& s);
|
|
void handlePropfind(WebServer& s);
|
|
void handleGet(WebServer& s);
|
|
void handleHead(WebServer& s);
|
|
void handlePut(WebServer& s);
|
|
void handleDelete(WebServer& s);
|
|
void handleMkcol(WebServer& s);
|
|
void handleMove(WebServer& s);
|
|
void handleCopy(WebServer& s);
|
|
void handleLock(WebServer& s);
|
|
void handleUnlock(WebServer& s);
|
|
|
|
// Utilities
|
|
String getRequestPath(WebServer& s) const;
|
|
String getDestinationPath(WebServer& s) const;
|
|
void urlEncodePath(const String& path, String& out) const;
|
|
bool isProtectedPath(const String& path) const;
|
|
int getDepth(WebServer& s) const;
|
|
bool getOverwrite(WebServer& s) const;
|
|
void clearEpubCacheIfNeeded(const String& path) const;
|
|
void sendPropEntry(WebServer& s, const String& href, bool isDir, size_t size, const String& lastModified) const;
|
|
String getMimeType(const String& path) const;
|
|
};
|