File tree Expand file tree Collapse file tree
deployed_version/types/web Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // Copyright [2025] [Argus]
2+ //
3+ // Licensed under the Apache License, Version 2.0 (the "License");
4+ // you may not use this file except in compliance with the License.
5+ // You may obtain a copy of the License at
6+ //
7+ // http://www.apache.org/licenses/LICENSE-2.0
8+ //
9+ // Unless required by applicable law or agreed to in writing, software
10+ // distributed under the License is distributed on an "AS IS" BASIS,
11+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ // See the License for the specific language governing permissions and
13+ // limitations under the License.
14+
115/*
216./healthcheck http://localhost:8080/api/v1/healthcheck
17+
318 200 == nothing
419 error == os.Exit(1)
520*/
621package main
722
823import (
9- "crypto/tls"
1024 "fmt"
1125 "net/http"
1226 "os"
@@ -20,7 +34,7 @@ func main() {
2034 url := os .Args [1 ]
2135
2236 //#nosec G402 -- Ignore TLS for healthcheck.
23- http .DefaultTransport .(* http.Transport ).TLSClientConfig = & tls. Config { InsecureSkipVerify : true }
37+ http .DefaultTransport .(* http.Transport ).TLSClientConfig . InsecureSkipVerify = true
2438 //#nosec G107 -- explicitly set URL.
2539 if _ , err := http .Get (url ); err != nil {
2640 fmt .Fprintf (os .Stderr , "error: %v" , err )
Original file line number Diff line number Diff line change 1616package web
1717
1818import (
19- "crypto/tls"
2019 "errors"
2120 "fmt"
2221 "io"
@@ -86,12 +85,11 @@ func (l *Lookup) query(writeToDB bool, logFrom logutil.LogFrom) error {
8685
8786// httpRequest makes a HTTP GET request to the URL, and returns the body.
8887func (l * Lookup ) httpRequest (logFrom logutil.LogFrom ) ([]byte , error ) {
89- customTransport := & http.Transport {}
88+ customTransport := http .DefaultTransport .( * http. Transport ). Clone ()
9089 // HTTPS insecure skip verify.
9190 if l .allowInvalidCerts () {
92- customTransport = http .DefaultTransport .(* http.Transport ).Clone ()
9391 //#nosec G402 -- explicitly wanted InsecureSkipVerify
94- customTransport .TLSClientConfig = & tls. Config { InsecureSkipVerify : true }
92+ customTransport .TLSClientConfig . InsecureSkipVerify = true
9593 }
9694
9795 // Create the request.
Original file line number Diff line number Diff line change 1616package web
1717
1818import (
19- "crypto/tls"
2019 "errors"
2120 "fmt"
2221 "io"
@@ -81,12 +80,11 @@ func (l *Lookup) query(logFrom logutil.LogFrom) (bool, error) {
8180
8281// httpRequest makes a HTTP GET request to the URL and returns the body.
8382func (l * Lookup ) httpRequest (logFrom logutil.LogFrom ) ([]byte , error ) {
84- customTransport := & http.Transport {}
83+ customTransport := http .DefaultTransport .( * http. Transport ). Clone ()
8584 // HTTPS insecure skip verify.
8685 if l .allowInvalidCerts () {
87- customTransport = http .DefaultTransport .(* http.Transport ).Clone ()
8886 //#nosec G402 -- explicitly wanted InsecureSkipVerify
89- customTransport .TLSClientConfig = & tls. Config { InsecureSkipVerify : true }
87+ customTransport .TLSClientConfig . InsecureSkipVerify = true
9088 }
9189
9290 // Create the request.
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ package webhook
1717
1818import (
1919 "context"
20- "crypto/tls"
2120 "errors"
2221 "fmt"
2322 "io"
@@ -124,11 +123,10 @@ func (wh *WebHook) try(logFrom logutil.LogFrom) error {
124123 defer cancel ()
125124
126125 // HTTPS insecure skip verify.
127- customTransport := & http.Transport {}
126+ customTransport := http .DefaultTransport .( * http. Transport ). Clone ()
128127 if wh .GetAllowInvalidCerts () {
129- customTransport = http .DefaultTransport .(* http.Transport ).Clone ()
130128 //#nosec G402 -- explicitly wanted InsecureSkipVerify.
131- customTransport .TLSClientConfig = & tls. Config { InsecureSkipVerify : true }
129+ customTransport .TLSClientConfig . InsecureSkipVerify = true
132130 }
133131
134132 client := & http.Client {Transport : customTransport }
You can’t perform that action at this time.
0 commit comments