lib/rwd/net.rb in rwdtinker-1.77 vs lib/rwd/net.rb in rwdtinker-1.78

- old
+ new

@@ -560,10 +560,16 @@ def inspect "(RequestRequest: %s)" % [@method, @path, @data, @protocol].join(", ") end end +def url_unescape(string) +string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do +[$1.delete('%')].pack('H*') +end +end + class Request < Hash attr_reader :peeraddr attr_reader :request attr_reader :cookies attr_reader :vars @@ -602,13 +608,16 @@ when "HEAD" when "GET" @vars = RequestGet.new(@request.data.nil? ? "" : @request.data) when "POST" data = (@io.read(self["content-length"].to_i) or "") + data = url_unescape(data) @vars = RequestPost.new((self["content-type"] == "application/x-www-form-urlencoded") ? data : "") else $stderr.puts "Unknown request ('#{firstline}')." end + $stderr.puts data + end @peeraddr = @io.peeraddr @pda = false