MCPcopy Index your code
hub / github.com/devploit/nomore403 / buildCurlCommand

Function buildCurlCommand

cmd/requester.go:534–554  ·  view source on GitHub ↗
(method, uri string, headers []header, body string, redirect bool, proxy *url.URL)

Source from the content-addressed store, hash-verified

532}
533
534func buildCurlCommand(method, uri string, headers []header, body string, redirect bool, proxy *url.URL) string {
535 var parts []string
536 parts = append(parts, "curl", "-i", "-sS", "-k")
537 if redirect {
538 parts = append(parts, "-L")
539 }
540 if method != "" && method != "GET" {
541 parts = append(parts, "-X", shellQuote(method))
542 }
543 if proxy != nil && proxy.String() != "" {
544 parts = append(parts, "-x", shellQuote(proxy.String()))
545 }
546 for _, h := range headers {
547 parts = append(parts, "-H", shellQuote(h.key+": "+h.value))
548 }
549 if body != "" {
550 parts = append(parts, "--data", shellQuote(body))
551 }
552 parts = append(parts, shellQuote(uri))
553 return strings.Join(parts, " ")
554}
555
556func shellQuote(s string) string {
557 return "'" + strings.ReplaceAll(s, "'", `'"'"'`) + "'"

Callers 4

attachHTTPReplayFunction · 0.85
attachRawReplayFunction · 0.85
requestIPEncodingHeadersFunction · 0.85

Calls 1

shellQuoteFunction · 0.85