[ap4r-devel] [ ap4r-Patches-20579 ] Allow use with SSL

noreply at rubyforge.org noreply at rubyforge.org
Mon Jun 9 09:58:40 EDT 2008


Patches item #20579, was opened at 2008-06-09 08:58
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=6912&aid=20579&group_id=1765

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: John Szurley (jszurley)
Assigned to: Nobody (None)
Summary: Allow use with SSL

Initial Comment:
Within the file dispatcher.rb
------------------------------------------
# Adding for using SSL 
require 'net/https'


      def invoke
        # TODO: should be added some request headers 2006/10/12 shino
        #       e.g. X-Ap4r-Version, Accept(need it?)
        # TODO: Now supports POST only, 2006/10/12 shino
        @response = nil
        uri = URI.parse(@message[:target_url])
        headers = make_header

        # TODO: SUPPORT SSL
        # Check if SSL is to be used
        if uri.port == @conf['ssl_port']
          http = Net::HTTP.new(uri.host, uri.port)
          http.use_ssl = true
          http.start do |http|
            @response, = http.post(uri.path, @message.object, headers)
          end
        else
          Net::HTTP.start(uri.host, uri.port) do |http|
            # TODO: global configuration over dispatchers for each protocol should be considered, 2008/02/06 by kiwamu
            # TODO: http open timeout should be considered, 2008/02/06 by kiwamu
            if @conf['http'] && @conf['http']['timeout']
              http.read_timeout = @conf['http']['timeout']
              logger.info "set HTTP read timeout to #{http.read_timeout}s"
            end
            @response, = http.post(uri.path, @message.object, headers)
          end
        end # if SSL
      end



Within the file queues.cfg
------------------------------------------
dispatchers:
  -
    targets: queue.*
    threads: 1
    ssl_port: 443




----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=6912&aid=20579&group_id=1765


More information about the ap4r-devel mailing list