TODO: User-Agent 先后顺序的问题 和 帐号密码

This commit is contained in:
huangsimin 2018-11-21 18:47:22 +08:00
parent 3156dd4da4
commit cad9668e4e

View File

@ -124,12 +124,16 @@ func judgeAndParseOptions(u *CURL, soption string) {
switch prefix := soption[0:2]; prefix {
case "-H":
parseHeader(u, soption)
case "--":
parseLongOption(u, soption)
case "-X":
matches := regexp.MustCompile("-X +(.+)").FindStringSubmatch(soption)
method := strings.Trim(matches[1], "'")
u.Method = method
case "-A": // User-Agent 先后顺序的问题
parseHeader(u, soption)
case "-I":
u.Method = "HEAD"
case "--":
parseLongOption(u, soption)
}
}
@ -163,7 +167,8 @@ func parseLongOption(u *CURL, soption string) {
case "data":
parseBodyASCII(u, data)
}
case regexp.MustCompile("^--header").MatchString(soption):
parseHeader(u, soption)
}
}
@ -220,7 +225,6 @@ func parseBodyBinary(u *CURL, data string) {
}
func parseHeader(u *CURL, soption string) {
matches := regexp.MustCompile(`'([^:]+): ([^']+)'`).FindAllStringSubmatch(soption, 1)[0]
key := matches[1]
value := matches[2]