summaryrefslogtreecommitdiff
path: root/lib/webrick
diff options
context:
space:
mode:
Diffstat (limited to 'lib/webrick')
-rw-r--r--lib/webrick/httpservlet/filehandler.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb
index 0780faf202..2044d6eabe 100644
--- a/lib/webrick/httpservlet/filehandler.rb
+++ b/lib/webrick/httpservlet/filehandler.rb
@@ -42,6 +42,11 @@ module WEBrick
# :stopdoc:
def do_GET(req, res)
+ case enc = Encoding.find('filesystem')
+ when Encoding::US_ASCII, Encoding::ASCII_8BIT
+ else
+ @local_path = @local_path.dup.force_encoding(enc)
+ end
st = File::stat(@local_path)
mtime = st.mtime
res['etag'] = sprintf("%x-%x-%x", st.ino, st.size, st.mtime.to_i)