Skip to content

Commit 9b65938

Browse files
committed
Got rid of serveStatic() attempt: it's difficult, I don't need it and it isn't used in the standard WebServer examples
1 parent 4c5dc83 commit 9b65938

File tree

2 files changed

+1
-54
lines changed

2 files changed

+1
-54
lines changed

src/ESPWebServer.cpp

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ void ESPWebServer::on(const String &uri, HTTPMethod method, THandlerFunction fn,
9494
}
9595

9696
void ESPWebServer::serveStatic(const char* uri, fs::FS& fs, const char* path, const char* cache_header) {
97-
// TODO: add * or something to path so serveStatic("/dir/",...) will serve all content from that directory
98-
ESPWebServerStaticNode *node = new ESPWebServerStaticNode(this, std::string(path), fs, path, cache_header);
99-
_server.registerNode(node);
97+
HTTPS_LOGE("serveStatic() not implemented");
10098
}
10199

102100
void ESPWebServer::onNotFound(THandlerFunction fn) {
@@ -328,33 +326,3 @@ ESPWebServerNode::ESPWebServerNode(
328326
ESPWebServerNode::~ESPWebServerNode() {
329327

330328
}
331-
332-
ESPWebServerStaticNode::ESPWebServerStaticNode(
333-
ESPWebServer *server,
334-
const std::string &path,
335-
FS& fs,
336-
const char *filePath,
337-
const char *cache_header)
338-
: ResourceNode(path, "GET", &(ESPWebServerStaticNode::_handlerWrapper), ""),
339-
_fs(fs),
340-
_filePath(filePath),
341-
_cache_header(cache_header),
342-
_isFile(false)
343-
{
344-
_isFile = _fs.exists(filePath);
345-
}
346-
347-
void ESPWebServerStaticNode::_handler(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res) {
348-
HTTPS_LOGE("static not yet implemented path=%s filePath=%s\n", _path.c_str(), _filePath);
349-
}
350-
351-
void ESPWebServerStaticNode::_handlerWrapper(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res) {
352-
ESPWebServerStaticNode *node = (ESPWebServerStaticNode*)req->getResolvedNode();
353-
node->_handler(req, res);
354-
}
355-
356-
357-
ESPWebServerStaticNode::~ESPWebServerStaticNode() {
358-
359-
}
360-

src/ESPWebServer.hpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,4 @@ class ESPWebServerNode : public httpsserver::ResourceNode {
154154
const THandlerFunction _wrappedUploadHandler;
155155
};
156156

157-
class ESPWebServerStaticNode : public httpsserver::ResourceNode {
158-
public:
159-
ESPWebServerStaticNode(
160-
ESPWebServer *server,
161-
const std::string &path,
162-
FS& fs,
163-
const char *filePath,
164-
const char *cache_header);
165-
virtual ~ESPWebServerStaticNode();
166-
167-
protected:
168-
static void _handlerWrapper(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
169-
void _handler(httpsserver::HTTPRequest *req, httpsserver::HTTPResponse *res);
170-
friend class ESPWebServer;
171-
ESPWebServer *_wrapper;
172-
FS& _fs;
173-
const char *_filePath;
174-
const char *_cache_header;
175-
bool _isFile;
176-
};
177-
178157
#endif //ESPWEBSERVER_H

0 commit comments

Comments
 (0)