@@ -21,55 +21,55 @@ class FunctionRequestHandler : public RequestHandler {
2121 delete _uri;
2222 }
2323
24- bool canHandle (HTTPMethod requestMethod, String requestUri) override {
24+ bool canHandle (HTTPMethod requestMethod, const String & requestUri) override {
2525 if (_method != HTTP_ANY && _method != requestMethod) {
2626 return false ;
2727 }
2828
2929 return _uri->canHandle (requestUri, pathArgs);
3030 }
3131
32- bool canUpload (String requestUri) override {
32+ bool canUpload (const String & requestUri) override {
3333 if (!_ufn || !canHandle (HTTP_POST, requestUri)) {
3434 return false ;
3535 }
3636
3737 return true ;
3838 }
3939
40- bool canRaw (String requestUri) override {
40+ bool canRaw (const String & requestUri) override {
4141 if (!_ufn || _method == HTTP_GET) {
4242 return false ;
4343 }
4444
4545 return true ;
4646 }
4747
48- bool canHandle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
48+ bool canHandle (WebServer &server, HTTPMethod requestMethod, const String & requestUri) override {
4949 if (_method != HTTP_ANY && _method != requestMethod) {
5050 return false ;
5151 }
5252
5353 return _uri->canHandle (requestUri, pathArgs) && (_filter != NULL ? _filter (server) : true );
5454 }
5555
56- bool canUpload (WebServer &server, String requestUri) override {
56+ bool canUpload (WebServer &server, const String & requestUri) override {
5757 if (!_ufn || !canHandle (server, HTTP_POST, requestUri)) {
5858 return false ;
5959 }
6060
6161 return true ;
6262 }
6363
64- bool canRaw (WebServer &server, String requestUri) override {
64+ bool canRaw (WebServer &server, const String & requestUri) override {
6565 if (!_ufn || _method == HTTP_GET || (_filter != NULL ? _filter (server) == false : false )) {
6666 return false ;
6767 }
6868
6969 return true ;
7070 }
7171
72- bool handle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
72+ bool handle (WebServer &server, HTTPMethod requestMethod, const String & requestUri) override {
7373 if (!canHandle (server, requestMethod, requestUri)) {
7474 return false ;
7575 }
@@ -78,14 +78,14 @@ class FunctionRequestHandler : public RequestHandler {
7878 return true ;
7979 }
8080
81- void upload (WebServer &server, String requestUri, HTTPUpload &upload) override {
81+ void upload (WebServer &server, const String & requestUri, HTTPUpload &upload) override {
8282 (void )upload;
8383 if (canUpload (server, requestUri)) {
8484 _ufn ();
8585 }
8686 }
8787
88- void raw (WebServer &server, String requestUri, HTTPRaw &raw) override {
88+ void raw (WebServer &server, const String & requestUri, HTTPRaw &raw) override {
8989 (void )raw;
9090 if (canRaw (server, requestUri)) {
9191 _ufn ();
@@ -118,7 +118,7 @@ class StaticRequestHandler : public RequestHandler {
118118 _baseUriLength = _uri.length ();
119119 }
120120
121- bool canHandle (HTTPMethod requestMethod, String requestUri) override {
121+ bool canHandle (HTTPMethod requestMethod, const String & requestUri) override {
122122 if (requestMethod != HTTP_GET) {
123123 return false ;
124124 }
@@ -130,7 +130,7 @@ class StaticRequestHandler : public RequestHandler {
130130 return true ;
131131 }
132132
133- bool canHandle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
133+ bool canHandle (WebServer &server, HTTPMethod requestMethod, const String & requestUri) override {
134134 if (requestMethod != HTTP_GET) {
135135 return false ;
136136 }
@@ -146,21 +146,20 @@ class StaticRequestHandler : public RequestHandler {
146146 return true ;
147147 }
148148
149- bool handle (WebServer &server, HTTPMethod requestMethod, String requestUri) override {
149+ bool handle (WebServer &server, HTTPMethod requestMethod, const String & requestUri) override {
150150 if (!canHandle (server, requestMethod, requestUri)) {
151151 return false ;
152152 }
153153
154154 log_v (" StaticRequestHandler::handle: request=%s _uri=%s\r\n " , requestUri.c_str (), _uri.c_str ());
155155
156156 String path (_path);
157- String eTagCode;
158157
159158 if (!_isFile) {
160159 // Base URI doesn't point to a file.
161160 // If a directory is requested, look for index file.
162161 if (requestUri.endsWith (" /" )) {
163- requestUri += " index.htm" ;
162+ return handle (server, requestMethod, String ( requestUri + " index.htm" )) ;
164163 }
165164
166165 // Append whatever follows this URI in request to get the file path.
@@ -184,6 +183,8 @@ class StaticRequestHandler : public RequestHandler {
184183 return false ;
185184 }
186185
186+ String eTagCode;
187+
187188 if (server._eTagEnabled ) {
188189 if (server._eTagFunction ) {
189190 eTagCode = (server._eTagFunction )(_fs, path);
0 commit comments