mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-12-04 22:08:23 +00:00
Use 64-bit stat in FileStat on Windows (#2705)
FileStat used struct _stat and _wstat on Windows, whose st_size is 32-bit, so _wstat failed with EOVERFLOW for a file of 2 GiB or more. is_file() then returned false, and set_mount_point served 404 for a file that exists; size() and mtime() had the same limit. struct _stat64 and _wstat64 have a 64-bit st_size.
This commit is contained in:
1 parent
852a66bcec
commit
a4697bd29d
1 file changed
+2
-2
@@ -3898,7 +3898,7 @@ struct FileStat {
|
||||
|
||||
private:
|
||||
#if defined(_WIN32)
|
||||
struct _stat st_;
|
||||
struct _stat64 st_;
|
||||
#else
|
||||
struct stat st_;
|
||||
#endif
|
||||
@@ -6464,7 +6464,7 @@ inline bool is_path_within_base(const std::string &resolved_path,
|
||||
inline FileStat::FileStat(const std::string &path) {
|
||||
#if defined(_WIN32)
|
||||
auto wpath = u8string_to_wstring(path.c_str());
|
||||
ret_ = _wstat(wpath.c_str(), &st_);
|
||||
ret_ = _wstat64(wpath.c_str(), &st_);
|
||||
#else
|
||||
ret_ = stat(path.c_str(), &st_);
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user