func decodeCrlsFromRow()

in go/rootprogram/issuers.go [293:327]


func decodeCrlsFromRow(aColMap map[string]int, aRow []string, aLineNum int) ([]string, error) {
	crls := []string{}
	fullCrlStr := aRow[aColMap["Full CRL Issued By This CA"]]
	fullCrlStr = strings.TrimSpace(fullCrlStr)
	if fullCrlStr != "" {
		fullCrlUrl, err := url.Parse(fullCrlStr)
		if err != nil {
			glog.Warningf("decodeCrlsFromRow: Line %d: Could not parse %q as URL: %v", aLineNum, fullCrlStr, err)
		} else if fullCrlUrl.Scheme != "http" && fullCrlUrl.Scheme != "https" {
			glog.Warningf("decodeCrlsFromRow: Line %d: Unknown URL scheme in %q", aLineNum, fullCrlUrl.String())
		} else {
			crls = append(crls, fullCrlUrl.String())
		}
	}

	partCrlJson := aRow[aColMap["JSON Array of Partitioned CRLs"]]
	partCrlJson = strings.Trim(strings.TrimSpace(partCrlJson), "[]")
	partCrls := strings.Split(partCrlJson, ",")
	for _, crl := range partCrls {
		crl = strings.TrimSpace(crl)
		if crl == "" {
			continue
		}
		crlUrl, err := url.Parse(crl)
		if err != nil {
			glog.Warningf("decodeCrlsFromRow: Line %d: Could not parse %q as URL: %v", aLineNum, crl, err)
		} else if crlUrl.Scheme != "http" && crlUrl.Scheme != "https" {
			glog.Warningf("decodeCrlsFromRow: Line %d: Unknown URL scheme in %q", aLineNum, crlUrl.String())
		} else {
			crls = append(crls, crlUrl.String())
		}
	}

	return crls, nil
}