Skip to content

Commit

Permalink
Revert "Workaround to permit certificates with leading "www." (#11)"
Browse files Browse the repository at this point in the history
This reverts commit 7d65fca.
  • Loading branch information
fritterhoff committed Jan 21, 2025
1 parent 208035d commit 3cec8b5
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ type Client struct {
}

type Domain struct {
Domain string `json:"domain"`
IncludeWWW bool `json:"includeWWW,omitempty"`
Domain string `json:"domain"`
}

type Option func(*Client)
Expand Down Expand Up @@ -355,24 +354,9 @@ func (c *Client) CheckDomainNames(domains []string) ([]models.DomainResponse, er
func (c *Client) RequestCertificate(domains []string, csr string, transactionType string, organization models.OrganizationResponse) (*models.CertificateRequestResponse, error) {
c.loginLock.RLock()
defer c.loginLock.RUnlock()

// Harica currently does not permit leading "www." in domains and
// requires the "includeWWW" option. It's not possible to create a
// certificate with only a domain with a leading "www.".
domainsMap := make(map[string]bool)
for _, domain := range domains {
domainsMap[domain] = true
}
var domainDto []Domain
for _, domain := range domains {
if strings.HasPrefix(domain, "www.") &&
domainsMap[strings.TrimPrefix(domain, "www.")] {
continue
}
domainDto = append(domainDto, Domain{
Domain: domain,
IncludeWWW: domainsMap["www."+domain],
})
domainDto = append(domainDto, Domain{Domain: domain})
}

// Ensure that the CSR is in the correct format so we parse it and transform it again
Expand Down

0 comments on commit 3cec8b5

Please sign in to comment.