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

Function validateURI

cmd/requester.go:3798–3813  ·  view source on GitHub ↗

validateURI checks that the URI is a valid HTTP(S) URL.

(uri string)

Source from the content-addressed store, hash-verified

3796
3797// validateURI checks that the URI is a valid HTTP(S) URL.
3798func validateURI(uri string) error {
3799 if uri == "" {
3800 return fmt.Errorf("URI is empty")
3801 }
3802 parsed, err := url.Parse(uri)
3803 if err != nil {
3804 return fmt.Errorf("invalid URI %q: %w", uri, err)
3805 }
3806 if parsed.Scheme != "http" && parsed.Scheme != "https" {
3807 return fmt.Errorf("invalid URI scheme %q (must be http or https): %s", parsed.Scheme, uri)
3808 }
3809 if parsed.Host == "" {
3810 return fmt.Errorf("URI has no host: %s", uri)
3811 }
3812 return nil
3813}
3814
3815// setupRequestOptions configures and returns RequestOptions based on the provided parameters.
3816func setupRequestOptions(uri, proxy, userAgent string, reqHeaders []string, bypassIP, folder, method string, verbose bool, techniques []string, banner, rateLimit bool, timeout int, redirect, randomAgent bool) RequestOptions {

Callers 2

requesterFunction · 0.85
TestValidateURIFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestValidateURIFunction · 0.68