mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-12-01 12:13:00 +03:00
misc
This commit is contained in:
parent
b6484ca639
commit
13ea138134
@ -8,11 +8,13 @@ import (
|
||||
)
|
||||
|
||||
// TrimProtocol removes the HTTP scheme from an URI
|
||||
func TrimProtocol(targetURL string) string {
|
||||
func TrimProtocol(targetURL string, addDefaultPort bool) string {
|
||||
URL := strings.TrimSpace(targetURL)
|
||||
if strings.HasPrefix(strings.ToLower(URL), "http://") || strings.HasPrefix(strings.ToLower(URL), "https://") {
|
||||
URL = AddURLDefaultPort(URL)
|
||||
URL = URL[strings.Index(URL, "//")+2:]
|
||||
if addDefaultPort {
|
||||
URL = AddURLDefaultPort(URL)
|
||||
URL = URL[strings.Index(URL, "//")+2:]
|
||||
}
|
||||
}
|
||||
|
||||
return URL
|
||||
|
@ -452,7 +452,7 @@ func (r *Runner) process(t string, wg *sizedwaitgroup.SizedWaitGroup, hp *httpx.
|
||||
if scanopts.NoFallback {
|
||||
protocols = []string{httpx.HTTPS, httpx.HTTP}
|
||||
}
|
||||
for target := range targets(stringz.TrimProtocol(t)) {
|
||||
for target := range targets(stringz.TrimProtocol(t, scanopts.NoFallback || scanopts.NoFallbackScheme)) {
|
||||
// if no custom ports specified then test the default ones
|
||||
if len(customport.Ports) == 0 {
|
||||
for _, method := range scanopts.Methods {
|
||||
@ -554,7 +554,6 @@ retry:
|
||||
URL, _ := urlutil.Parse(domain)
|
||||
URL.Scheme = protocol
|
||||
|
||||
// if domain doesn't contain port remove it
|
||||
if !strings.Contains(domain, URL.Port) {
|
||||
URL.Port = ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user