def request_uri=(new_request_uri)
if !new_request_uri.respond_to?(:to_str)
raise TypeError, "Can't convert #{new_request_uri.class} into String."
end
if self.absolute? && self.scheme !~ /^https?$/
raise InvalidURIError,
"Cannot set an HTTP request URI for a non-HTTP URI."
end
new_request_uri = new_request_uri.to_str
path_component = new_request_uri[/^([^\?]*)\?(?:.*)$/, 1]
query_component = new_request_uri[/^(?:[^\?]*)\?(.*)$/, 1]
path_component = path_component.to_s
path_component = (!path_component.empty? ? path_component : SLASH)
self.path = path_component
self.query = query_component
@uri_string = nil
@hash = nil
end