Fixed goconst issues

This commit is contained in:
Víctor Zamanillo 2020-09-25 19:27:19 +02:00
parent 938d59e1bd
commit 18e5dae704
2 changed files with 12 additions and 5 deletions

View File

@ -98,7 +98,7 @@ func main() {
if len(scanopts.Methods) == 0 {
scanopts.Methods = append(scanopts.Methods, "GET")
}
protocol := "https"
protocol := httpx.HTTPS
scanopts.VHost = options.VHost
scanopts.OutputTitle = options.ExtractTitle
scanopts.OutputStatusCode = options.StatusCode
@ -362,10 +362,10 @@ retry:
resp, err := hp.Do(req)
if err != nil {
if !retried {
if protocol == "https" {
protocol = "http"
if protocol == httpx.HTTPS {
protocol = httpx.HTTP
} else {
protocol = "https"
protocol = httpx.HTTPS
}
retried = true
goto retry

View File

@ -8,10 +8,17 @@ import (
"github.com/projectdiscovery/retryablehttp-go"
)
const (
// HTTP defines the plain http scheme
HTTP = "http"
// HTTPS defines the secure http scheme
HTTPS = "https"
)
// SupportHTTP2 checks if the target host supports HTTP2
func (h *HTTPX) SupportHTTP2(protocol, method, targetURL string) bool {
// http => supports HTTP1.1 => HTTP/2 (H2C)
if protocol == "http" {
if protocol == HTTP {
req, err := retryablehttp.NewRequest(method, targetURL, nil)
if err != nil {
return false