TODO: User-Agent 先后顺序的问题 和 帐号密码
This commit is contained in:
parent
3156dd4da4
commit
cad9668e4e
@ -124,12 +124,16 @@ func judgeAndParseOptions(u *CURL, soption string) {
|
|||||||
switch prefix := soption[0:2]; prefix {
|
switch prefix := soption[0:2]; prefix {
|
||||||
case "-H":
|
case "-H":
|
||||||
parseHeader(u, soption)
|
parseHeader(u, soption)
|
||||||
case "--":
|
|
||||||
parseLongOption(u, soption)
|
|
||||||
case "-X":
|
case "-X":
|
||||||
matches := regexp.MustCompile("-X +(.+)").FindStringSubmatch(soption)
|
matches := regexp.MustCompile("-X +(.+)").FindStringSubmatch(soption)
|
||||||
method := strings.Trim(matches[1], "'")
|
method := strings.Trim(matches[1], "'")
|
||||||
u.Method = method
|
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":
|
case "data":
|
||||||
parseBodyASCII(u, 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) {
|
func parseHeader(u *CURL, soption string) {
|
||||||
|
|
||||||
matches := regexp.MustCompile(`'([^:]+): ([^']+)'`).FindAllStringSubmatch(soption, 1)[0]
|
matches := regexp.MustCompile(`'([^:]+): ([^']+)'`).FindAllStringSubmatch(soption, 1)[0]
|
||||||
key := matches[1]
|
key := matches[1]
|
||||||
value := matches[2]
|
value := matches[2]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user