# File lib/puma/binder.rb, line 81
    def parse(binds, logger)
      binds.each do |str|
        uri = URI.parse str
        case uri.scheme
        when "tcp"
          if fd = @inherited_fds.delete(str)
            logger.log "* Inherited #{str}"
            io = inherit_tcp_listener uri.host, uri.port, fd
          else
            logger.log "* Listening on #{str}"
            io = add_tcp_listener uri.host, uri.port
          end

          @listeners << [str, io]
        when "unix"
          path = "#{uri.host}#{uri.path}"

          if fd = @inherited_fds.delete(str)
            logger.log "* Inherited #{str}"
            io = inherit_unix_listener path, fd
          else
            logger.log "* Listening on #{str}"

            umask = nil

            if uri.query
              params = Rack::Utils.parse_query uri.query
              if u = params['umask']
                # Use Integer() to respect the 0 prefix as octal
                umask = Integer(u)
              end
            end

            io = add_unix_listener path, umask
          end

          @listeners << [str, io]
        when "ssl"
          if IS_JRUBY
            @events.error "SSL not supported on JRuby"
            raise UnsupportedOption
          end

          params = Rack::Utils.parse_query uri.query
          require 'puma/minissl'

          ctx = MiniSSL::Context.new
          unless params['key']
            @events.error "Please specify the SSL key via 'key='"
          end

          ctx.key = params['key']

          unless params['cert']
            @events.error "Please specify the SSL cert via 'cert='"
          end

          ctx.cert = params['cert']

          ctx.verify_mode = MiniSSL::VERIFY_NONE

          if fd = @inherited_fds.delete(str)
            logger.log "* Inherited #{str}"
            io = inherited_ssl_listener fd, ctx
          else
            logger.log "* Listening on #{str}"
            io = add_ssl_listener uri.host, uri.port, ctx
          end

          @listeners << [str, io]
        else
          logger.error "Invalid URI: #{str}"
        end
      end

      # If we inherited fds but didn't use them (because of a
      # configuration change), then be sure to close them.
      @inherited_fds.each do |str, fd|
        logger.log "* Closing unused inherited connection: #{str}"

        begin
          if fd.kind_of? TCPServer
            fd.close
          else
            IO.for_fd(fd).close
          end

        rescue SystemCallError
        end

        # We have to unlink a unix socket path that's not being used
        uri = URI.parse str
        if uri.scheme == "unix"
          path = "#{uri.host}#{uri.path}"
          File.unlink path
        end
      end

    end