Sha256: d2c74395f5f2e1f4d41906f96fe06b62981297965f65ef1999682f2bc602dc1e

Contents?: true

Size: 774 Bytes

Versions: 4

Compression:

Stored size: 774 Bytes

Contents

require 'm2r/response'

module M2R
  class Response

    # Handles the logic of having response with proper
    # http version and 'Connection' header in relation to
    # given request
    #
    # @api public
    module ToRequest
      # params [Request] request Request that response handles
      # params [true, false] identical Whether http version in response should be identical
      #   to the received one.
      # @return [self] Response object
      # @api public
      def to(request, identical = false)
        # http://www.ietf.org/rfc/rfc2145.txt
        # 2.3 Which version number to send in a message
        http_version(request.http_version) if identical
        headers['Connection'] = 'close' if request.close?
        self
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
m2r-2.1.0.pre lib/m2r/response/to_request.rb
m2r-2.0.2 lib/m2r/response/to_request.rb
m2r-2.0.1 lib/m2r/response/to_request.rb
m2r-2.0.0 lib/m2r/response/to_request.rb