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

Changeset 1863

Show
Ignore:
Timestamp:
06/26/07 23:11:57 (1 year ago)
Author:
nahi
Message:
  • follow http-access-2.0.8-SNAPSHOT
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/soap/test_httpconfigloader.rb

    r1862 r1863  
    1313  def setup 
    1414    @client = SOAP::RPC::Driver.new(nil, nil) 
     15  end 
     16 
     17  class Request 
     18    class Header 
     19      attr_reader :request_uri 
     20      def initialize(request_uri) 
     21        @request_uri = request_uri 
     22      end 
     23    end 
     24 
     25    attr_reader :header 
     26    def initialize(request_uri) 
     27      @header = Header.new(request_uri) 
     28    end 
    1529  end 
    1630 
     
    4256      cred2 = ["user2:password2"].pack('m').tr("\n", '') 
    4357      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"))) 
     58      basic_auth.challenge(URI.parse("http://www.example.com/"), nil) 
     59      assert_equal(cred1, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo1/baz")))) 
     60      assert_equal(cred2, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo2/")))) 
     61      assert_equal(cred3, basic_auth.get(Request.new(URI.parse("http://www.example.com/foo3/baz/qux")))) 
    4762    ensure 
    4863      File.unlink(testpropertyname) 
  • trunk/test/soap/test_streamhandler.rb

    r1794 r1863  
    4343      WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc).to_proc) 
    4444    ) 
     45    htpasswd = File.join(File.dirname(__FILE__), 'htpasswd') 
     46    htpasswd_userdb = WEBrick::HTTPAuth::Htpasswd.new(htpasswd) 
     47    @basic_auth = WEBrick::HTTPAuth::BasicAuth.new( 
     48      :Realm => 'auth', 
     49      :UserDB => htpasswd_userdb 
     50    ) 
     51    @server.mount( 
     52      '/basic_auth', 
     53      WEBrick::HTTPServlet::ProcHandler.new(method(:do_server_proc_basic_auth).to_proc) 
     54    ) 
    4555    @server_thread = TestUtil.start_server_thread(@server) 
    4656  end 
     
    5969    @client = SOAP::RPC::Driver.new(@url, '') 
    6070    @client.add_method("do_server_proc") 
     71    @client.add_method("do_server_proc_basic_auth") 
    6172  end 
    6273 
     
    91102  end 
    92103 
     104  def do_server_proc_basic_auth(req, res) 
     105    @basic_auth.authenticate(req, res) 
     106    do_server_proc(req, res) 
     107  end 
     108 
    93109  def parse_req_header(str) 
    94110    if ::SOAP::HTTPStreamHandler::Client.to_s == 'SOAP::NetHttpClient' 
     
    148164      return 
    149165    end 
    150     str = "" 
    151     @client.wiredump_dev = str 
    152     @client.options["protocol.http.basic_auth"] << [@url, "foo", "bar"] 
    153     assert_nil(@client.do_server_proc) 
    154     r, h = parse_req_header(str) 
    155     assert_equal("Basic Zm9vOmJhcg==", h["authorization"]) 
     166    @client.endpoint_url = @url + 'basic_auth' 
     167    str = "" 
     168    @client.wiredump_dev = str 
     169    @client.options["protocol.http.basic_auth"] << [@url, "admin", "admin"] 
     170    assert_nil(@client.do_server_proc_basic_auth) 
    156171  end 
    157172