diff -Nuar webrick/htmlutils.rb webrick/htmlutils.rb
--- webrick0/htmlutils.rb 2013-05-15 10:03:08 +0800
+++ webrick/htmlutils.rb 2013-05-18 14:04:34 +0800
@@ -15,12 +15,12 @@
# Escapes &, ", > and < in +string+
def escape(string)
- str = string ? string.dup : ""
+ str = string ? string.b.dup : "".b
str.gsub!(/&/n, '&')
str.gsub!(/\"/n, '"')
str.gsub!(/>/n, '>')
str.gsub!(/#{HTMLUtils::escape(dname)}"
- s << " " * (30 - dname.bytesize)
+ s << " " * (30 - dname.bytesize) rescue nil
s << (time ? time.strftime("%Y/%m/%d %H:%M ") : " " * 22)
s << (size >= 0 ? size.to_s : "-") << "\n"
res.body << s
diff -Nuar webrick/httputils.rb webrick/httputils.rb
--- webrick0/httputils.rb 2013-05-15 10:03:08 +0800
+++ webrick/httputils.rb 2013-05-18 14:04:51 +0800
@@ -452,14 +452,14 @@
# Escapes HTTP reserved and unwise characters in +str+
def escape(str)
- _escape(str, UNESCAPED)
+ _escape(str.b, UNESCAPED).force_encoding(Encoding.default_external)
end
##
# Unescapes HTTP reserved and unwise characters in +str+
def unescape(str)
- _unescape(str, ESCAPED)
+ _unescape(str.b, ESCAPED).force_encoding(Encoding.default_external)
end
##