MCPcopy Create free account
hub / github.com/devploit/nomore403 / buildCurlParserInvocation

Function buildCurlParserInvocation

cmd/requester.go:2534–2556  ·  view source on GitHub ↗
(method, uri string, proxy string, followRedirects bool)

Source from the content-addressed store, hash-verified

2532}
2533
2534func 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
2558func curlRequest(args []string, httpVersion string, timeout int) Result {
2559 if len(args) == 0 {

Calls 1

shellQuoteFunction · 0.85