Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/protocols/http/utils_test.go
4538 views
1
package http
2
3
import (
4
"bytes"
5
"testing"
6
7
"github.com/stretchr/testify/require"
8
)
9
10
func TestGetHTTPProjectCacheScope_SeparatesSchemeAndPort(t *testing.T) {
11
requestDump := []byte("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
12
13
httpScoped := getHTTPProjectCacheScope(requestDump, "http", "example.com:80")
14
httpsScoped := getHTTPProjectCacheScope(requestDump, "https", "example.com:443")
15
16
require.NotEqual(t, httpScoped, httpsScoped)
17
require.True(t, bytes.HasSuffix(httpScoped, requestDump))
18
require.True(t, bytes.HasSuffix(httpsScoped, requestDump))
19
}
20
21