Skip to content

Commit e825f24

Browse files
fix: change the default HTTP protocol to HTTPS (#165)
1 parent 711d830 commit e825f24

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd/http.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Examples:
7070

7171
// http specific flags
7272
localFlags.BoolP("help", "h", false, "help for http")
73-
localFlags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "specify the protocol to use: HTTP, HTTPS, or HTTP2 (default \"HTTP\")")
73+
localFlags.StringVar(&r.ctx.Protocol, "protocol", r.ctx.Protocol, "specify the protocol to use: HTTP, HTTPS, or HTTP2 (default \"HTTPS\")")
7474
localFlags.IntVar(&r.ctx.Port, "port", r.ctx.Port, "specify the port to use (default 80 for HTTP, 443 for HTTPS and HTTP2)")
7575
localFlags.StringVar(&r.ctx.Resolver, "resolver", r.ctx.Resolver, "specify the hostname or IP address of the name server to use for the DNS lookup (default defined by the probe)")
7676
localFlags.StringVar(&r.ctx.Host, "host", r.ctx.Host, "specify the Host header to add to the request (default host's defined in command target)")
@@ -204,7 +204,7 @@ func parseUrlData(input string) (*UrlData, error) {
204204

205205
// add url scheme if missing
206206
if !strings.HasPrefix(input, "http://") && !strings.HasPrefix(input, "https://") {
207-
input = "http://" + input
207+
input = "https://" + input
208208
}
209209

210210
// Parse input

cmd/http_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func Test_Execute_HTTP_IPv4(t *testing.T) {
9595
defer ctrl.Finish()
9696

9797
expectedOpts := createDefaultMeasurementCreate("http")
98-
expectedOpts.Options.Protocol = "http"
98+
expectedOpts.Options.Protocol = "https"
9999
expectedOpts.Options.IPVersion = globalping.IPVersion4
100100
expectedOpts.Options.Request = &globalping.RequestOptions{
101101
Headers: map[string]string{},
@@ -137,7 +137,7 @@ func Test_Execute_HTTP_IPv6(t *testing.T) {
137137
defer ctrl.Finish()
138138

139139
expectedOpts := createDefaultMeasurementCreate("http")
140-
expectedOpts.Options.Protocol = "http"
140+
expectedOpts.Options.Protocol = "https"
141141
expectedOpts.Options.IPVersion = globalping.IPVersion6
142142
expectedOpts.Options.Request = &globalping.RequestOptions{
143143
Headers: map[string]string{},
@@ -189,7 +189,7 @@ func Test_ParseUrlData_NoScheme(t *testing.T) {
189189
assert.NoError(t, err)
190190
assert.Equal(t, "cdn.jsdelivr.net", urlData.Host)
191191
assert.Equal(t, "/npm/react/", urlData.Path)
192-
assert.Equal(t, "http", urlData.Protocol)
192+
assert.Equal(t, "https", urlData.Protocol)
193193
assert.Equal(t, 0, urlData.Port)
194194
assert.Equal(t, "query=3", urlData.Query)
195195
}
@@ -199,7 +199,7 @@ func Test_ParseUrlData_HostOnly(t *testing.T) {
199199
assert.NoError(t, err)
200200
assert.Equal(t, "cdn.jsdelivr.net", urlData.Host)
201201
assert.Equal(t, "", urlData.Path)
202-
assert.Equal(t, "http", urlData.Protocol)
202+
assert.Equal(t, "https", urlData.Protocol)
203203
assert.Equal(t, 0, urlData.Port)
204204
assert.Equal(t, "", urlData.Query)
205205
}

0 commit comments

Comments
 (0)