* add support to hex/%u encode a URI

git-svn-id: file:///home/svn/incoming/trunk@3517 4d416f70-5f16-0410-b530-b9f4589650da
unstable
bmc 2006-02-06 22:48:57 +00:00
parent ca315abe1b
commit 1351ceed1c
1 changed files with 17 additions and 0 deletions

View File

@ -138,6 +138,20 @@ class Request < Packet
str.sub!(/^[\/]+/, '/') # only one beginning slash! str.sub!(/^[\/]+/, '/') # only one beginning slash!
end end
# / can't be encoded on most web servers...
if self.uri_encode_mode
case self.uri_encode_mode
when 'hex-all'
str = escape(str, 1).gsub!(/%2f/i, '/')
when 'hex-normal'
str = escape(str).gsub!(/%2f/i, '/')
when 'u-normal'
str = escape(str).gsub!(/%2f/i, '/').gsub!(/%/,'%u00')
when 'u-all'
str = escape(str, 1).gsub!(/%2f/i, '/').gsub!(/%/,'%u00')
end
end
if !PostRequests.include?(self.method) if !PostRequests.include?(self.method)
if param_string.size > 0 if param_string.size > 0
str += '?' + param_string str += '?' + param_string
@ -296,6 +310,9 @@ class Request < Packet
# add junk pipeline requests # add junk pipeline requests
attr_accessor :junk_pipeline attr_accessor :junk_pipeline
# encoding uri
attr_accessor :uri_encode_mode
protected protected
# #