mirror of
https://github.com/projectdiscovery/httpx.git
synced 2024-09-11 17:46:08 +03:00
Fixed goconst issues
This commit is contained in:
parent
938d59e1bd
commit
18e5dae704
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user