Permalink
Browse files

Don't cache net/http object so that ActiveResource is more thread-safe.

Closes #10142 [kou]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent a76490d commit 24e6cbc724b006ea4febb1948b921387e9021177 @technoweenie technoweenie committed Nov 19, 2007
Showing with 8 additions and 9 deletions.
  1. +2 −0 activeresource/CHANGELOG
  2. +6 −9 activeresource/lib/active_resource/connection.rb
View
@@ -1,3 +1,5 @@
+* Don't cache net/http object so that ActiveResource is more thread-safe. Closes #10142 [kou]
+
* Update XML documentation examples to include explicit type attributes. Closes #9754 [hasmanyjosh]
*2.0.0 [Preview Release]* (September 29th, 2007)
@@ -127,16 +127,13 @@ def handle_response(response)
end
end
- # Creates new (or uses currently instantiated) Net::HTTP instance for communication with
+ # Creates new Net::HTTP instance for communication with
# remote service and resources.
def http
- unless @http
- @http = Net::HTTP.new(@site.host, @site.port)
- @http.use_ssl = @site.is_a?(URI::HTTPS)
- @http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @http.use_ssl
- end
-
- @http
+ http = Net::HTTP.new(@site.host, @site.port)
+ http.use_ssl = @site.is_a?(URI::HTTPS)
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl
+ http
end
def default_header
@@ -157,4 +154,4 @@ def logger #:nodoc:
ActiveResource::Base.logger
end
end
-end
+end

0 comments on commit 24e6cbc

Please sign in to comment.