1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

non-persistent connections for rackspace

This commit is contained in:
Wesley Beary 2010-01-12 22:00:22 -08:00
parent 341071a0f5
commit 63d939f6ed
3 changed files with 7 additions and 4 deletions

View file

@ -7,7 +7,7 @@ require "#{current_directory}/lib/fog"
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.add_dependency('excon', '>=0.0.17')
gem.add_dependency('excon', '>=0.0.18')
gem.add_dependency('mime-types')
gem.add_dependency('nokogiri')
gem.add_dependency('ruby-hmac')

View file

@ -21,13 +21,11 @@ module Fog
@cdn_path = cdn_uri.path
@cdn_port = cdn_uri.port
@cdn_scheme = cdn_uri.scheme
@cdn_connection = Fog::Connection.new("#{@cdn_scheme}://#{@cdn_host}:#{@cdn_port}")
storage_uri = URI.parse(credentials['X-Storage-Url'])
@storage_host = storage_uri.host
@storage_path = storage_uri.path
@storage_port = storage_uri.port
@storage_scheme = storage_uri.scheme
@storage_connection = Fog::Connection.new("#{@storage_scheme}://#{@storage_host}:#{@storage_port}")
end
def parse_data(data)
@ -52,10 +50,12 @@ module Fog
end
def cdn_request(params)
@cdn_connection = Fog::Connection.new("#{@cdn_scheme}://#{@cdn_host}:#{@cdn_port}")
response = @cdn_connection.request({
:body => params[:body],
:expects => params[:expects],
:headers => {
'Content-Type' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @cdn_host,
@ -70,10 +70,12 @@ module Fog
end
def storage_request(params)
@storage_connection = Fog::Connection.new("#{@storage_scheme}://#{@storage_host}:#{@storage_port}")
response = @storage_connection.request({
:body => params[:body],
:expects => params[:expects],
:headers => {
'Content-Type' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @storage_host,

View file

@ -57,14 +57,15 @@ module Fog
@path = uri.path
@port = uri.port
@scheme = uri.scheme
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
end
def request(params)
@connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}")
response = @connection.request({
:body => params[:body],
:expects => params[:expects],
:headers => {
'Content-Type' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:host => @host,