module Protocol::HTTP::URL

def self.assign(keys, value, parent)

def self.assign(keys, value, parent)
	top, *middle = keys
	
	middle.each_with_index do |key, index|
		if key.nil? or key.empty?
			parent = (parent[top] ||= Array.new)
			top = parent.size
			
			if nested = middle[index+1] and last = parent.last
				top -= 1 unless last.include?(nested)
			end
		else
			parent = (parent[top] ||= Hash.new)
			top = key
		end
	end
	
	parent[top] = value
end