| 2532 | } |
| 2533 | |
| 2534 | func buildCurlParserInvocation(method, uri string, proxy string, followRedirects bool) ([]string, string) { |
| 2535 | args := []string{"-i", "-s", "--http1.1"} |
| 2536 | displayArgs := []string{"curl", "-i", "-s", "--http1.1"} |
| 2537 | if method != "" && method != "GET" { |
| 2538 | args = append(args, "-X", method) |
| 2539 | displayArgs = append(displayArgs, "-X", shellQuote(method)) |
| 2540 | } |
| 2541 | for _, headerName := range []string{"User-Agent", "Accept", "Connection", "Host"} { |
| 2542 | args = append(args, "-H", headerName+":") |
| 2543 | displayArgs = append(displayArgs, "-H", shellQuote(headerName+":")) |
| 2544 | } |
| 2545 | if proxy != "" { |
| 2546 | args = append(args, "-x", proxy) |
| 2547 | displayArgs = append(displayArgs, "-x", shellQuote(proxy)) |
| 2548 | } |
| 2549 | if followRedirects { |
| 2550 | args = append(args, "-L") |
| 2551 | displayArgs = append(displayArgs, "-L") |
| 2552 | } |
| 2553 | args = append(args, "--insecure", uri) |
| 2554 | displayArgs = append(displayArgs, "--insecure", shellQuote(uri)) |
| 2555 | return args, strings.Join(displayArgs, " ") |
| 2556 | } |
| 2557 | |
| 2558 | func curlRequest(args []string, httpVersion string, timeout int) Result { |
| 2559 | if len(args) == 0 { |