Skip to content

Commit

Permalink
* let SessionManager inherit proxy and debug_dev setting from client…
Browse files Browse the repository at this point in the history
…. closes #196. Normally SessionManager is a private class for HTTPClient and is initialized as expected. If you need to instanciate SessionManager independently, you may need this patch.

git-svn-id: http://dev.ctor.org/svn/http-access2/trunk@266 a74cc93d-ecea-0310-97c0-aac310535a50
  • Loading branch information
nahi committed Feb 7, 2009
1 parent db32fdf commit ecd49c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/httpclient/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ class SessionManager

def initialize(client)
@client = client
@proxy = nil
@proxy = client.proxy

@agent_name = nil
@from = nil

@protocol_version = nil
@debug_dev = nil
@debug_dev = client.debug_dev
@socket_sync = true
@chunk_size = 4096

Expand Down
11 changes: 11 additions & 0 deletions test/test_httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,17 @@ def test_response
end
end

def test_session_manager
mgr = HTTPClient::SessionManager.new(@client)
assert_nil(mgr.instance_eval { @proxy })
assert_nil(mgr.debug_dev)
@client.debug_dev = Object.new
@client.proxy = 'http://myproxy:12345'
mgr = HTTPClient::SessionManager.new(@client)
assert_equal('http://myproxy:12345', mgr.instance_eval { @proxy }.to_s)
assert_equal(@client.debug_dev, mgr.debug_dev)
end

private

def check_query_get(query)
Expand Down

0 comments on commit ecd49c7

Please sign in to comment.