Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ce89ac1

Browse files
committed
unused templated code throws out unused statics
1 parent afd713e commit ce89ac1

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

‎libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,7 @@
99

1010
namespace esp8266webserver {
1111

12-
// calculate an ETag for a file in filesystem based on md5 checksum
13-
// that can be used in the http headers - include quotes.
14-
static String calcETag(FS &fs, const String &path) {
15-
String result;
16-
17-
// calculate eTag using md5 checksum
18-
uint8_t md5_buf[16];
19-
File f = fs.open(path, "r");
20-
MD5Builder calcMD5;
21-
calcMD5.begin();
22-
calcMD5.addStream(f, f.size());
23-
calcMD5.calculate();
24-
calcMD5.getBytes(md5_buf);
25-
f.close();
26-
// create a minimal-length eTag using base64 byte[]->text encoding.
27-
result = "\"" + base64::encode(md5_buf, 16, false) + "\"";
28-
return(result);
29-
} // calcETag
30-
12+
String calcETag(FS &, const String &);
3113

3214
template<typename ServerType>
3315
class FunctionRequestHandler : public RequestHandler<ServerType> {
@@ -310,4 +292,4 @@ public StaticRequestHandler<ServerType> {
310292

311293
} // namespace
312294

313-
#endif //REQUESTHANDLERSIMPL_H
295+
#endif //REQUESTHANDLERSIMPL_H
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <ESP8266WebServer.h>
2+
3+
namespace esp8266webserver {
4+
5+
// calculate an ETag for a file in filesystem based on md5 checksum
6+
// that can be used in the http headers - include quotes.
7+
String calcETag(FS &fs, const String &path) {
8+
String result;
9+
10+
// calculate eTag using md5 checksum
11+
uint8_t md5_buf[16];
12+
File f = fs.open(path, "r");
13+
MD5Builder calcMD5;
14+
calcMD5.begin();
15+
calcMD5.addStream(f, f.size());
16+
calcMD5.calculate();
17+
calcMD5.getBytes(md5_buf);
18+
f.close();
19+
// create a minimal-length eTag using base64 byte[]->text encoding.
20+
result = "\"" + base64::encode(md5_buf, 16, false) + "\"";
21+
return(result);
22+
}
23+
24+
} // namespace esp8266webserver

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /