Skip to content

Commit

Permalink
Don't cache net/http object so that ActiveResource is more thread-safe.
Browse files Browse the repository at this point in the history
Closes #10142 [kou]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Nov 19, 2007
1 parent a76490d commit 24e6cbc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions activeresource/CHANGELOG
@@ -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] * Update XML documentation examples to include explicit type attributes. Closes #9754 [hasmanyjosh]


*2.0.0 [Preview Release]* (September 29th, 2007) *2.0.0 [Preview Release]* (September 29th, 2007)
Expand Down
15 changes: 6 additions & 9 deletions activeresource/lib/active_resource/connection.rb
Expand Up @@ -127,16 +127,13 @@ def handle_response(response)
end end
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. # remote service and resources.
def http def http
unless @http http = Net::HTTP.new(@site.host, @site.port)
@http = Net::HTTP.new(@site.host, @site.port) http.use_ssl = @site.is_a?(URI::HTTPS)
@http.use_ssl = @site.is_a?(URI::HTTPS) http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE if @http.use_ssl http
end

@http
end end


def default_header def default_header
Expand All @@ -157,4 +154,4 @@ def logger #:nodoc:
ActiveResource::Base.logger ActiveResource::Base.logger
end end
end end
end end

0 comments on commit 24e6cbc

Please sign in to comment.