mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 13:45:28 +00:00
Removed else branch
typeHostWithOptionalPort return the host raw input value if has not port
This commit is contained in:
parent
c97c3aca33
commit
bbee2ee8db
@ -100,9 +100,8 @@ func (h *Helper) convertInputToType(input string, inputType inputType, defaultPo
|
||||
}
|
||||
if isURL {
|
||||
return uri.Hostname()
|
||||
} else {
|
||||
return input
|
||||
}
|
||||
return input
|
||||
case typeURL:
|
||||
if uri != nil && (uri.Scheme == "http" || uri.Scheme == "https") {
|
||||
return input
|
||||
@ -122,6 +121,12 @@ func (h *Helper) convertInputToType(input string, inputType inputType, defaultPo
|
||||
if hasDefaultPort {
|
||||
return net.JoinHostPort(input, defaultPort)
|
||||
}
|
||||
|
||||
if inputType == typeHostWithOptionalPort {
|
||||
return input
|
||||
}
|
||||
|
||||
return ""
|
||||
case typeWebsocket:
|
||||
if uri != nil && (uri.Scheme == "ws" || uri.Scheme == "wss") {
|
||||
return input
|
||||
|
||||
@ -51,7 +51,7 @@ func TestConvertInputToType(t *testing.T) {
|
||||
{"google.com", typeHostWithPort, "google.com:443", "443"},
|
||||
|
||||
// host with optional port
|
||||
{"google.com", typeHostWithOptionalPort, "", ""},
|
||||
{"google.com", typeHostWithOptionalPort, "google.com", ""},
|
||||
{"google.com:443", typeHostWithOptionalPort, "google.com:443", ""},
|
||||
{"https://google.com", typeHostWithOptionalPort, "google.com:443", ""},
|
||||
{"https://google.com:443", typeHostWithOptionalPort, "google.com:443", ""},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user