Class: WEBrick::HTTPRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/n/app/webrick-servlet.rb

Instance Method Summary collapse

Instance Method Details

#__rewrite(uri) ⇒ Object

gmosx, FIXME: temp hack!



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/n/app/webrick-servlet.rb', line 31

def __rewrite(uri)
	# FIXME: scan for first ONLY.
	realm = uri.scan(/^\/(.*?)\//)
	realm = realm[0][0] unless realm.empty?

	if rules = $rewrites[realm]
		for rule in rules
			return uri if uri.gsub!(rule[0], rule[1])
		end
	end
	
	return uri
end

#old_parse_uriObject



24
# File 'lib/n/app/webrick-servlet.rb', line 24

alias_method :old_parse_uri, :parse_uri

#parse_uri(str, scheme = "http") ⇒ Object



25
26
27
# File 'lib/n/app/webrick-servlet.rb', line 25

def parse_uri(str, scheme="http")
	old_parse_uri(__rewrite(str.dup), scheme)
end