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

Changeset 1760

Show
Ignore:
Timestamp:
05/11/07 14:53:28 (2 years ago)
Author:
nahi
Message:
  • allow to set basic_auth definition in soap/property file. closes #198.
  • do not do pretty-printing when a SOAPElement does not have any elements. closes #336.
Files:

Legend:

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

    r1754 r1760  
    9595    name = generator.encode_name_end(ns, data) 
    9696    cr = (data.is_a?(SOAPCompoundtype) or 
    97       (data.is_a?(SOAPElement) and !data.text)) 
     97      (data.is_a?(SOAPElement) and !data.members.empty?)) 
    9898    generator.encode_tag_end(name, cr) 
    9999  end 
  • trunk/lib/soap/httpconfigloader.rb

    r1616 r1760  
    5353 
    5454  def set_basic_auth(client, basic_auth) 
    55     basic_auth.values.each do |url, userid, passwd| 
     55    basic_auth.values.each do |ele| 
     56      if ele.is_a?(::Array) 
     57        url, userid, passwd = ele 
     58      else 
     59        url, userid, passwd = ele[:url], ele[:userid], ele[:password] 
     60      end 
    5661      client.set_basic_auth(url, userid, passwd) 
    5762    end 
  • trunk/test/soap/test_httpconfigloader.rb

    r1615 r1760  
    1919    File.open(testpropertyname, "w") do |f| 
    2020      f <<<<__EOP__ 
     21protocol.http.proxy = http://myproxy:8080 
    2122protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_PEER 
    2223# depth: 1 causes an error (intentional) 
    2324protocol.http.ssl_config.verify_depth = 1 
    2425protocol.http.ssl_config.ciphers = ALL 
     26protocol.http.basic_auth.1.url = http://www.example.com/foo1/ 
     27protocol.http.basic_auth.1.userid = user1 
     28protocol.http.basic_auth.1.password = password1 
     29protocol.http.basic_auth.2.url = http://www.example.com/foo2/ 
     30protocol.http.basic_auth.2.userid = user2 
     31protocol.http.basic_auth.2.password = password2 
    2532__EOP__ 
    2633    end 
     
    2835      @client.loadproperty(testpropertyname) 
    2936      assert_equal('ALL', @client.options['protocol.http.ssl_config.ciphers']) 
     37      @client.options['protocol.http.basic_auth'] << 
     38        ['http://www.example.com/foo3/', 'user3', 'password3'] 
     39      h = @client.streamhandler.client 
     40      basic_auth = h.instance_eval { @basic_auth } 
     41      cred1 = ["user1:password1"].pack('m').tr("\n", '') 
     42      cred2 = ["user2:password2"].pack('m').tr("\n", '') 
     43      cred3 = ["user3:password3"].pack('m').tr("\n", '') 
     44      assert_equal(cred1, basic_auth.get(URI.parse("http://www.example.com/foo1/baz"))) 
     45      assert_equal(cred2, basic_auth.get(URI.parse("http://www.example.com/foo2/"))) 
     46      assert_equal(cred3, basic_auth.get(URI.parse("http://www.example.com/foo3/baz/qux"))) 
    3047    ensure 
    3148      File.unlink(testpropertyname)