File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 4
4
#include < ios>
5
5
#include < fstream>
6
6
#include < sstream>
7
+ // S_ISREG is not defined for windows
8
+ // This defines it like suggested in https://stackoverflow.com/a/62371749
9
+ #if defined(_MSC_VER)
10
+ #define _CRT_INTERNAL_NONSTDC_NAMES 1
11
+ #endif
7
12
#include < sys/stat.h>
13
+ #if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
14
+ #define S_ISREG (m ) (((m)&S_IFMT) == S_IFREG)
15
+ #endif
8
16
9
17
#include " crow/http_request.h"
10
18
#include " crow/ci_map.h"
@@ -233,7 +241,7 @@ namespace crow
233
241
#ifdef CROW_ENABLE_COMPRESSION
234
242
compressed = false ;
235
243
#endif
236
- if (file_info.statResult == 0 )
244
+ if (file_info.statResult == 0 && S_ISREG (file_info. statbuf . st_mode ) )
237
245
{
238
246
std::size_t last_dot = path.find_last_of (" ." );
239
247
std::string extension = path.substr (last_dot + 1 );
@@ -257,7 +265,6 @@ namespace crow
257
265
{
258
266
code = 404 ;
259
267
file_info.path .clear ();
260
- this ->end ();
261
268
}
262
269
}
263
270
You can’t perform that action at this time.
0 commit comments