diff options
author | Nelson Vides <[email protected]> | 2025-09-03 11:32:00 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-09-17 15:02:24 +0200 |
commit | 833764ea4cffe3327a4a4472264e3ae6f44a9b2a (patch) | |
tree | ffbcc69e6592acb381b4d14adef79504874da03d /src | |
parent | 6f62c27d948aa559ae5b691b8ad9ba73934f40df (diff) | |
download | cowboy-833764ea4cffe3327a4a4472264e3ae6f44a9b2a.tar.gz cowboy-833764ea4cffe3327a4a4472264e3ae6f44a9b2a.tar.bz2 cowboy-833764ea4cffe3327a4a4472264e3ae6f44a9b2a.zip |
Use raw mode to read from the file info
Rescue from https://github.com/ninenines/cowboy/pull/1687
See https://erlangforums.com/t/cowboy-2-13-0-performance-bottleneck-at-8-7k-rps-on-erlang-28-0-2/5004
Co-authored-by: Zabrane <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_static.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_static.erl b/src/cowboy_static.erl index ce34b01..be3906b 100644 --- a/src/cowboy_static.erl +++ b/src/cowboy_static.erl @@ -183,12 +183,12 @@ init_info(Req, Path, HowToAccess, Extra) -> {cowboy_rest, Req, {Path, Info, Extra}}. read_file_info(Path, direct) -> - case file:read_file_info(Path, [{time, universal}]) of + case file:read_file_info(Path, [raw, {time, universal}]) of {ok, Info} -> {direct, Info}; Error -> Error end; read_file_info(Path, {archive, Archive}) -> - case file:read_file_info(Archive, [{time, universal}]) of + case file:read_file_info(Archive, [raw, {time, universal}]) of {ok, ArchiveInfo} -> %% The Erlang application archive is fine. %% Now check if the requested file is in that |