validateURI checks that the URI is a valid HTTP(S) URL.
(uri string)
| 3796 | |
| 3797 | // validateURI checks that the URI is a valid HTTP(S) URL. |
| 3798 | func 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. |
| 3816 | func setupRequestOptions(uri, proxy, userAgent string, reqHeaders []string, bypassIP, folder, method string, verbose bool, techniques []string, banner, rateLimit bool, timeout int, redirect, randomAgent bool) RequestOptions { |
no outgoing calls