qheader

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2019 License: MIT Imports: 3 Imported by: 6

README

qheader

解析报 quality factor 报头的内容

Documentation

Overview

Package qheader 用于处理 quality factor 报头。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Header struct {
	Content string // 完整的内容

	// 解析之后的内容
	Value string
	Q     float32
}

Header 表示 Header* 的报头元素

func Parse

func Parse(header string) ([]*Header, error)

Parse 将报头内容解析为 []*Header,并对内容进行排序之后返回。

排序方式如下:

Q 值大的靠前,如果 Q 值相同,则全名的比带通配符的靠前,*/* 最后。

q 值为 0 的数据将被过滤,比如:

application/*;q=0.1,application/xml;q=0.1,text/html;q=0

其中的 text/html 不会被返回,application/xml 的优先级会高于 application/*

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL