parse_accept_header (OpenID::Yadis)

    # File lib/openid/yadis/accept.rb, line 39
        def self.parse_accept_header(value)
          # Parse an accept header, ignoring any accept-extensions
          #
          # returns a list of tuples containing main MIME type, MIME
          # subtype, and quality markdown.
          #
          # str -> [(str, str, float)]
          chunks = value.split(',', -1).collect { |v| v.strip }
          accept = []
          chunks.each { |chunk|
            parts = chunk.split(";", -1).collect { |s| s.strip }

            mtype = parts.shift
            if mtype.index('/').nil?
              # This is not a MIME type, so ignore the bad data
              next
            end

            main, sub = mtype.split('/', 2)

            q = nil
            parts.each { |ext|
              if !ext.index('=').nil?
                k, v = ext.split('=', 2)
                if k == 'q'
                  q = v.to_f
                end
              end
            }

            q = 1.0 if q.nil?

            accept << [q, main, sub]
          }

          accept.sort!
          accept.reverse!

          return accept.collect { |q, main, sub| [main, sub, q] }
        end