Patches: Browse | Submit New | Admin

[#20579] Allow use with SSL

Date:
2008-06-09 13:58
Priority:
3
Submitted By:
John Szurley (jszurley)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Allow use with SSL

Detailed description
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


Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item