Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 1614

Show
Ignore:
Timestamp:
09/12/05 21:31:15 (3 years ago)
Author:
nahi
Message:

avoid NameError? when http-access2 not installed. closes #145.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/streamHandler.rb

    r1606 r1614  
    2121 
    2222class StreamHandler 
    23   Client = begin 
    24       require 'http-access2' 
    25       if HTTPAccess2::VERSION < "2.0" 
    26         raise LoadError.new("http-access/2.0 or later is required.") 
    27       end 
    28       HTTPAccess2::Client 
    29     rescue LoadError 
    30       warn("Loading http-access2 failed.  Net/http is used.") if $DEBUG 
    31       require 'soap/netHttpClient' 
    32       SOAP::NetHttpClient 
    33     end 
    34  
    3523  RUBY_VERSION_STRING = "ruby #{ RUBY_VERSION } (#{ RUBY_RELEASE_DATE }) [#{ RUBY_PLATFORM }]" 
    36  
    37   RETRYABLE = (Client == HTTPAccess2::Client) 
    3824 
    3925  class ConnectionData 
     
    7359  include SOAP 
    7460 
     61  begin 
     62    require 'http-access2' 
     63    if HTTPAccess2::VERSION < "2.0" 
     64      raise LoadError.new("http-access/2.0 or later is required.") 
     65    end 
     66    Client = HTTPAccess2::Client 
     67    RETRYABLE = true 
     68  rescue LoadError 
     69    warn("Loading http-access2 failed.  Net/http is used.") if $DEBUG 
     70    require 'soap/netHttpClient' 
     71    Client = SOAP::NetHttpClient 
     72    RETRYABLE = false 
     73  end 
     74 
     75 
    7576public 
    7677   
     
    7879  attr_accessor :wiredump_file_base 
    7980   
    80   NofRetry = 10               # [times] 
     81  MAX_RETRY_COUNT = 10        # [times] 
    8182 
    8283  def initialize(options) 
     
    170171        if RETRYABLE and HTTP::Status.redirect?(res.status) 
    171172          retry_count += 1 
    172           if retry_count >= 10 
     173          if retry_count >= MAX_RETRY_COUNT 
    173174            raise HTTPStreamError.new("redirect count exceeded") 
    174175          end