10func GetCertPool(paths []string) (*x509.CertPool, error) {
12 return nil, fmt.Errorf("invalid empty list of Root CAs file paths")
14 pool := x509.NewCertPool()
15 for _, path := range paths {
16 // Cert paths are a configurable option
17 data, err := ioutil.ReadFile(path) // #nosec G304
19 return nil, fmt.Errorf("certificate authority file (%s) could not be read - %s", path, err)
21 if !pool.AppendCertsFromPEM(data) {
22 return nil, fmt.Errorf("loading certificate authority (%s) failed", path)
28// GetRequestHost return the request host header or X-Forwarded-Host if present
29func GetRequestHost(req *http.Request) string {
30 host := req.Header.Get("X-Forwarded-Host")
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list