class Chef::HTTP::CookieManager
An HTTP
middleware to manage storing/sending cookies in HTTP
requests. Most HTTP
communication in Chef
does not need cookies, it was originally implemented to support OpenID, but it's not known who might be relying on it, so it's included with Chef::REST
Public Class Methods
new(options = {})
click to toggle source
# File lib/chef/http/cookie_manager.rb, line 30 def initialize(options = {}) @cookies = CookieJar.instance end
Public Instance Methods
handle_request(method, url, headers = {}, data = false)
click to toggle source
# File lib/chef/http/cookie_manager.rb, line 34 def handle_request(method, url, headers = {}, data = false) @host, @port = url.host, url.port if @cookies.key?("#{@host}:#{@port}") headers["Cookie"] = @cookies["#{@host}:#{@port}"] end [method, url, headers, data] end
handle_response(http_response, rest_request, return_value)
click to toggle source
# File lib/chef/http/cookie_manager.rb, line 42 def handle_response(http_response, rest_request, return_value) if http_response["set-cookie"] @cookies["#{@host}:#{@port}"] = http_response["set-cookie"] end [http_response, rest_request, return_value] end
handle_stream_complete(http_response, rest_request, return_value)
click to toggle source
# File lib/chef/http/cookie_manager.rb, line 53 def handle_stream_complete(http_response, rest_request, return_value) [http_response, rest_request, return_value] end
stream_response_handler(response)
click to toggle source
# File lib/chef/http/cookie_manager.rb, line 49 def stream_response_handler(response) nil end