mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 20:05:24 +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 {
|
if isURL {
|
||||||
return uri.Hostname()
|
return uri.Hostname()
|
||||||
} else {
|
|
||||||
return input
|
|
||||||
}
|
}
|
||||||
|
return input
|
||||||
case typeURL:
|
case typeURL:
|
||||||
if uri != nil && (uri.Scheme == "http" || uri.Scheme == "https") {
|
if uri != nil && (uri.Scheme == "http" || uri.Scheme == "https") {
|
||||||
return input
|
return input
|
||||||
@ -122,6 +121,12 @@ func (h *Helper) convertInputToType(input string, inputType inputType, defaultPo
|
|||||||
if hasDefaultPort {
|
if hasDefaultPort {
|
||||||
return net.JoinHostPort(input, defaultPort)
|
return net.JoinHostPort(input, defaultPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if inputType == typeHostWithOptionalPort {
|
||||||
|
return input
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
case typeWebsocket:
|
case typeWebsocket:
|
||||||
if uri != nil && (uri.Scheme == "ws" || uri.Scheme == "wss") {
|
if uri != nil && (uri.Scheme == "ws" || uri.Scheme == "wss") {
|
||||||
return input
|
return input
|
||||||
|
|||||||
@ -51,7 +51,7 @@ func TestConvertInputToType(t *testing.T) {
|
|||||||
{"google.com", typeHostWithPort, "google.com:443", "443"},
|
{"google.com", typeHostWithPort, "google.com:443", "443"},
|
||||||
|
|
||||||
// host with optional port
|
// host with optional port
|
||||||
{"google.com", typeHostWithOptionalPort, "", ""},
|
{"google.com", typeHostWithOptionalPort, "google.com", ""},
|
||||||
{"google.com:443", typeHostWithOptionalPort, "google.com:443", ""},
|
{"google.com:443", typeHostWithOptionalPort, "google.com:443", ""},
|
||||||
{"https://google.com", typeHostWithOptionalPort, "google.com:443", ""},
|
{"https://google.com", typeHostWithOptionalPort, "google.com:443", ""},
|
||||||
{"https://google.com:443", typeHostWithOptionalPort, "google.com:443", ""},
|
{"https://google.com:443", typeHostWithOptionalPort, "google.com:443", ""},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user