Documentation
¶
Index ¶
- Variables
- func HtmlExtractLink(body string, nofollow bool, fun func(u string))
- func ParseDisposition(disposition string) string
- func QueryGet(query url.Values, k, dfValue string) string
- func QueryGetSlice(r *http.Request, key string, step string) []string
- func QueryValid(query url.Values, k string, rule *regexp.Regexp) (string, error)
- func QueryValidAll(query url.Values, k string, rules []*regexp.Regexp) (string, error)
- func QueryValidAny(query url.Values, k string, rules []*regexp.Regexp) (string, error)
- func RespCloneHeader(w http.ResponseWriter, header http.Header)
- func SetDisposition(w http.ResponseWriter, filename string)
- func Substr(s string, n int) string
- func SubstrTag(s string, n int) string
- type Striptag
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PageCharacterSetPreg = regexp.MustCompile(`(?i)<meta[\s\S]+?charset=['"]?([\w-]+)['"]?[\s\S]*?>`) // 匹配页面 字符集 ALinkRegex = regexp.MustCompile(`(?i)\<(?:a|mip\-link)\s[\s\S]*?href=['"]([\s\S]*?)['"][\s\S]*?\>`) // 匹配页面 所有a标签的正则表达式 Nofollow = regexp.MustCompile(`(?i)rel=['"]nofollow['"]`) // 匹配 rel=nofollow TitleRegex = regexp.MustCompile(`(?i)\<title[\s\S]*?\>([\s\S]*?)\<\/title\>`) // 匹配页面 title的正则表达式 )
Functions ¶
func HtmlExtractLink ¶
func ParseDisposition ¶
ParseDisposition 从Content-Disposition头中解析出原始文件名 兼容处理各种格式,包括inline和其他类型的disposition
func QueryGetSlice ¶
QueryGetSlice 获取query参数,并分割
func QueryValid ¶
QueryValid 验证query参数,如果规则不匹配就返回错误
func QueryValidAll ¶
QueryValidAll 验证query参数,所有规则都需要满足
func QueryValidAny ¶
QueryValidAny 验证query参数,只要满足其中一个规则就返回
func RespCloneHeader ¶
func RespCloneHeader(w http.ResponseWriter, header http.Header)
RespCloneHeader 响应复制header
func SetDisposition ¶
func SetDisposition(w http.ResponseWriter, filename string)
SetDisposition 文件下载时候,设置中文文件名
Types ¶
Click to show internal directories.
Click to hide internal directories.