lib/rtsp/message.rb
def default_headers
      headers = {}

      if @request_uri.user and @request_uri.password
        credentials = "#{@request_uri.user}:#{@request_uri.password}"
        headers[:authorization] = "Basic #{Base64.strict_encode64(credentials)}"
        @request_uri.user = nil
        @request_uri.password = nil
      end

      headers[:cseq] ||= RTSP_DEFAULT_SEQUENCE_NUMBER
      headers[:user_agent] ||= USER_AGENT

      case @method_type
      when :describe
        headers[:accept] = RTSP_ACCEPT_TYPE
      when :announce
        headers[:content_type] = RTSP_ACCEPT_TYPE
      when :play
        headers[:range] = "npt=#{RTSP_DEFAULT_NPT}"
      when :get_parameter
        headers[:content_type] = 'text/parameters'
      when :set_parameter
        headers[:content_type] = 'text/parameters'
      else
        {}
      end

      headers
    end
# Returns the required/default headers for the provided method.
#
# @return [Hash] The default headers for the given method.
Returns the required/default headers for the provided method.
Returns the required / default headers for the provided method .
def default_headers
      headers = {}
      if @request_uri.user and @request_uri.password
        credentials = "#{@request_uri.user}:#{@request_uri.password}"
        headers[:authorization] = "Basic #{Base64.strict_encode64(credentials)}"
        @request_uri.user = nil
        @request_uri.password = nil
      end
      headers[:cseq] ||= RTSP_DEFAULT_SEQUENCE_NUMBER
      headers[:user_agent] ||= USER_AGENT
      case @method_type
      when :describe
        headers[:accept] = RTSP_ACCEPT_TYPE
      when :announce
        headers[:content_type] = RTSP_ACCEPT_TYPE
      when :play
        headers[:range] = "npt=#{RTSP_DEFAULT_NPT}"
      when :get_parameter
        headers[:content_type] = 'text/parameters'
      when :set_parameter
        headers[:content_type] = 'text/parameters'
      else
        {}
      end
      headers
    end
def default_headers headers = { } if @request_uri . user and @request_uri . password credentials = "#{@request_uri.user}:#{@request_uri.password}" headers [ :authorization ] = "Basic #{Base64.strict_encode64(credentials)}" @request_uri . user = nil @request_uri . password = nil end headers [ :cseq ] ||= RTSP_DEFAULT_SEQUENCE_NUMBER headers [ :user_agent ] ||= USER_AGENT case @method_type when :describe headers [ :accept ] = RTSP_ACCEPT_TYPE when :announce headers [ :content_type ] = RTSP_ACCEPT_TYPE when :play headers [ :range ] = "npt=#{RTSP_DEFAULT_NPT}" when :get_parameter headers [ :content_type ] = 'text/parameters' when :set_parameter headers [ :content_type ] = 'text/parameters' else { } end headers end
Returns the required/default headers for the provided method.
Returns the required / default headers for the provided method .
The default headers for the given method.
The default headers for the given method .
Hash