@@ -21,55 +21,55 @@ class FunctionRequestHandler : public RequestHandler {
21
21
delete _uri;
22
22
}
23
23
24
- bool canHandle (HTTPMethod requestMethod, String requestUri) override {
24
+ bool canHandle (HTTPMethod requestMethod, const String& requestUri) override {
25
25
if (_method != HTTP_ANY && _method != requestMethod) {
26
26
return false ;
27
27
}
28
28
29
29
return _uri->canHandle (requestUri, pathArgs);
30
30
}
31
31
32
- bool canUpload (String requestUri) override {
32
+ bool canUpload (const String& requestUri) override {
33
33
if (!_ufn || !canHandle (HTTP_POST, requestUri)) {
34
34
return false ;
35
35
}
36
36
37
37
return true ;
38
38
}
39
39
40
- bool canRaw (String requestUri) override {
40
+ bool canRaw (const String& requestUri) override {
41
41
if (!_ufn || _method == HTTP_GET) {
42
42
return false ;
43
43
}
44
44
45
45
return true ;
46
46
}
47
47
48
- bool canHandle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
48
+ bool canHandle (WebServer &server, HTTPMethod requestMethod, const String& requestUri) override {
49
49
if (_method != HTTP_ANY && _method != requestMethod) {
50
50
return false ;
51
51
}
52
52
53
53
return _uri->canHandle (requestUri, pathArgs) && (_filter != NULL ? _filter (server) : true );
54
54
}
55
55
56
- bool canUpload (WebServer &server, String requestUri) override {
56
+ bool canUpload (WebServer &server, const String& requestUri) override {
57
57
if (!_ufn || !canHandle (server, HTTP_POST, requestUri)) {
58
58
return false ;
59
59
}
60
60
61
61
return true ;
62
62
}
63
63
64
- bool canRaw (WebServer &server, String requestUri) override {
64
+ bool canRaw (WebServer &server, const String& requestUri) override {
65
65
if (!_ufn || _method == HTTP_GET || (_filter != NULL ? _filter (server) == false : false )) {
66
66
return false ;
67
67
}
68
68
69
69
return true ;
70
70
}
71
71
72
- bool handle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
72
+ bool handle (WebServer &server, HTTPMethod requestMethod, const String& requestUri) override {
73
73
if (!canHandle (server, requestMethod, requestUri)) {
74
74
return false ;
75
75
}
@@ -78,14 +78,14 @@ class FunctionRequestHandler : public RequestHandler {
78
78
return true ;
79
79
}
80
80
81
- void upload (WebServer &server, String requestUri, HTTPUpload &upload) override {
81
+ void upload (WebServer &server, const String& requestUri, HTTPUpload &upload) override {
82
82
(void )upload;
83
83
if (canUpload (server, requestUri)) {
84
84
_ufn ();
85
85
}
86
86
}
87
87
88
- void raw (WebServer &server, String requestUri, HTTPRaw &raw) override {
88
+ void raw (WebServer &server, const String& requestUri, HTTPRaw &raw) override {
89
89
(void )raw;
90
90
if (canRaw (server, requestUri)) {
91
91
_ufn ();
@@ -118,7 +118,7 @@ class StaticRequestHandler : public RequestHandler {
118
118
_baseUriLength = _uri.length ();
119
119
}
120
120
121
- bool canHandle (HTTPMethod requestMethod, String requestUri) override {
121
+ bool canHandle (HTTPMethod requestMethod, const String& requestUri) override {
122
122
if (requestMethod != HTTP_GET) {
123
123
return false ;
124
124
}
@@ -130,7 +130,7 @@ class StaticRequestHandler : public RequestHandler {
130
130
return true ;
131
131
}
132
132
133
- bool canHandle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
133
+ bool canHandle (WebServer &server, HTTPMethod requestMethod, const String& requestUri) override {
134
134
if (requestMethod != HTTP_GET) {
135
135
return false ;
136
136
}
@@ -146,21 +146,20 @@ class StaticRequestHandler : public RequestHandler {
146
146
return true ;
147
147
}
148
148
149
- bool handle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
149
+ bool handle (WebServer &server, HTTPMethod requestMethod, const String& requestUri) override {
150
150
if (!canHandle (server, requestMethod, requestUri)) {
151
151
return false ;
152
152
}
153
153
154
154
log_v (" StaticRequestHandler::handle: request=%s _uri=%s\r\n " , requestUri.c_str (), _uri.c_str ());
155
155
156
156
String path (_path);
157
- String eTagCode;
158
157
159
158
if (!_isFile) {
160
159
// Base URI doesn't point to a file.
161
160
// If a directory is requested, look for index file.
162
161
if (requestUri.endsWith (" /" )) {
163
- requestUri += " index.htm" ;
162
+ return handle (server, requestMethod, String ( requestUri + " index.htm" )) ;
164
163
}
165
164
166
165
// Append whatever follows this URI in request to get the file path.
@@ -184,6 +183,8 @@ class StaticRequestHandler : public RequestHandler {
184
183
return false ;
185
184
}
186
185
186
+ String eTagCode;
187
+
187
188
if (server._eTagEnabled ) {
188
189
if (server._eTagFunction ) {
189
190
eTagCode = (server._eTagFunction )(_fs, path);
0 commit comments