From acd4406e1d8f7fd8fea56ab7f53299c59662901a Mon Sep 17 00:00:00 2001 From: John Hyland Date: Wed, 28 Oct 2009 17:39:34 -0400 Subject: [PATCH] add URI scheme checking --- lib/httparty/request.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/httparty/request.rb b/lib/httparty/request.rb index 84eb5d7..b869625 100644 --- a/lib/httparty/request.rb +++ b/lib/httparty/request.rb @@ -1,8 +1,10 @@ require 'uri' module HTTParty + class Request #:nodoc: SupportedHTTPMethods = [Net::HTTP::Get, Net::HTTP::Post, Net::HTTP::Put, Net::HTTP::Delete] + SupportedURISchemes = [URI::HTTP, URI::HTTPS] attr_accessor :http_method, :path, :options @@ -27,6 +29,10 @@ module HTTParty new_uri.query = query_string(new_uri) end + unless SupportedURISchemes.include? new_uri.class + raise ArgumentError, "Cannot parse '#{new_uri}' as a supported URI class" + end + new_uri end