Issue #8425 has been updated by windwiny (wind winy).


@nobu, 

webrick\httputils.rb
    def _unescape(str, regex)
      str = str.b
      str.gsub!(regex) {$1.hex.chr}
      # encoding of %-unescaped string is unknown
      str
    end

_unescape return ASCII-8BIT str, may be improper?

can you test firefox on similar dir '/tmp/1/Uni1/2/Uni2/' ?


btw, webrick\httpservlet\filehandler.rb
         list.each{ |name, time, size|
           if name == ".."
             dname = "Parent Directory"
-          elsif name.bytesize > 25
-            dname = name.sub(/^(.{23})(?:.*)/, '\1..')
           else
-            dname = name
+            dname = name[0...23] << '..'
           end

The delete line has a bug, The meaning all file has add '..', even filename short 25

----------------------------------------
Bug #8425: webrick show local filesystem charset bug
https://bugs.ruby-lang.org/issues/8425#change-39449

Author: windwiny (wind winy)
Status: Closed
Priority: Normal
Assignee: 
Category: lib
Target version: 
ruby -v: 2.0.0
Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED


Shell command

    ruby -run -e httpd Dir1

run a webrick http server, can not show no 8bit-ascii directory/file name.

this patch can fix this problem, can review it?

    patch file

or github
    https://github.com/windwiny/ruby/tree/webrick_fn




-- 
http://bugs.ruby-lang.org/