mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
Fix typos (#6311)
* Fix typos * Revert * Revert to "htlm" * fix indentations
This commit is contained in:
parent
e60148ecc3
commit
d7e3a1974b
13 changed files with 25 additions and 25 deletions
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
@ -25,7 +25,7 @@ Other menu items:
|
||||||
|
|
||||||
You can have a huge impact on the project by helping with its code. To contribute code to Caddy, first submit or comment in an issue to discuss your contribution, then open a [pull request](https://github.com/caddyserver/caddy/pulls) (PR). If you're new to our community, that's okay: **we gladly welcome pull requests from anyone, regardless of your native language or coding experience.** You can get familiar with Caddy's code base by using [code search at Sourcegraph](https://sourcegraph.com/github.com/caddyserver/caddy).
|
You can have a huge impact on the project by helping with its code. To contribute code to Caddy, first submit or comment in an issue to discuss your contribution, then open a [pull request](https://github.com/caddyserver/caddy/pulls) (PR). If you're new to our community, that's okay: **we gladly welcome pull requests from anyone, regardless of your native language or coding experience.** You can get familiar with Caddy's code base by using [code search at Sourcegraph](https://sourcegraph.com/github.com/caddyserver/caddy).
|
||||||
|
|
||||||
We hold contributions to a high standard for quality :bowtie:, so don't be surprised if we ask for revisions—even if it seems small or insignificant. Please don't take it personally. :blue_heart: If your change is on the right track, we can guide you to make it mergable.
|
We hold contributions to a high standard for quality :bowtie:, so don't be surprised if we ask for revisions—even if it seems small or insignificant. Please don't take it personally. :blue_heart: If your change is on the right track, we can guide you to make it mergeable.
|
||||||
|
|
||||||
Here are some of the expectations we have of contributors:
|
Here are some of the expectations we have of contributors:
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ type Defaults struct {
|
||||||
// Port we expect caddy to listening on
|
// Port we expect caddy to listening on
|
||||||
AdminPort int
|
AdminPort int
|
||||||
// Certificates we expect to be loaded before attempting to run the tests
|
// Certificates we expect to be loaded before attempting to run the tests
|
||||||
Certifcates []string
|
Certificates []string
|
||||||
// TestRequestTimeout is the time to wait for a http request to
|
// TestRequestTimeout is the time to wait for a http request to
|
||||||
TestRequestTimeout time.Duration
|
TestRequestTimeout time.Duration
|
||||||
// LoadRequestTimeout is the time to wait for the config to be loaded against the caddy server
|
// LoadRequestTimeout is the time to wait for the config to be loaded against the caddy server
|
||||||
|
@ -46,7 +46,7 @@ type Defaults struct {
|
||||||
// Default testing values
|
// Default testing values
|
||||||
var Default = Defaults{
|
var Default = Defaults{
|
||||||
AdminPort: 2999, // different from what a real server also running on a developer's machine might be
|
AdminPort: 2999, // different from what a real server also running on a developer's machine might be
|
||||||
Certifcates: []string{"/caddy.localhost.crt", "/caddy.localhost.key"},
|
Certificates: []string{"/caddy.localhost.crt", "/caddy.localhost.key"},
|
||||||
TestRequestTimeout: 5 * time.Second,
|
TestRequestTimeout: 5 * time.Second,
|
||||||
LoadRequestTimeout: 5 * time.Second,
|
LoadRequestTimeout: 5 * time.Second,
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ const initConfig = `{
|
||||||
// designated path and Caddy sub-process is running.
|
// designated path and Caddy sub-process is running.
|
||||||
func validateTestPrerequisites(t testing.TB) error {
|
func validateTestPrerequisites(t testing.TB) error {
|
||||||
// check certificates are found
|
// check certificates are found
|
||||||
for _, certName := range Default.Certifcates {
|
for _, certName := range Default.Certificates {
|
||||||
if _, err := os.Stat(getIntegrationDir() + certName); errors.Is(err, fs.ErrNotExist) {
|
if _, err := os.Stat(getIntegrationDir() + certName); errors.Is(err, fs.ErrNotExist) {
|
||||||
return fmt.Errorf("caddy integration test certificates (%s) not found", certName)
|
return fmt.Errorf("caddy integration test certificates (%s) not found", certName)
|
||||||
}
|
}
|
||||||
|
|
16
listeners.go
16
listeners.go
|
@ -149,11 +149,11 @@ func (na NetworkAddress) Listen(ctx context.Context, portOffset uint, config net
|
||||||
|
|
||||||
func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net.ListenConfig) (any, error) {
|
func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net.ListenConfig) (any, error) {
|
||||||
var (
|
var (
|
||||||
ln any
|
ln any
|
||||||
err error
|
err error
|
||||||
address string
|
address string
|
||||||
unixFileMode fs.FileMode
|
unixFileMode fs.FileMode
|
||||||
isAbtractUnixSocket bool
|
isAbstractUnixSocket bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// split unix socket addr early so lnKey
|
// split unix socket addr early so lnKey
|
||||||
|
@ -164,7 +164,7 @@ func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
isAbtractUnixSocket = strings.HasPrefix(address, "@")
|
isAbstractUnixSocket = strings.HasPrefix(address, "@")
|
||||||
} else {
|
} else {
|
||||||
address = na.JoinHostPort(portOffset)
|
address = na.JoinHostPort(portOffset)
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net
|
||||||
// if this is a unix socket, see if we already have it open,
|
// if this is a unix socket, see if we already have it open,
|
||||||
// force socket permissions on it and return early
|
// force socket permissions on it and return early
|
||||||
if socket, err := reuseUnixSocket(na.Network, address); socket != nil || err != nil {
|
if socket, err := reuseUnixSocket(na.Network, address); socket != nil || err != nil {
|
||||||
if !isAbtractUnixSocket {
|
if !isAbstractUnixSocket {
|
||||||
if err := os.Chmod(address, unixFileMode); err != nil {
|
if err := os.Chmod(address, unixFileMode); err != nil {
|
||||||
return nil, fmt.Errorf("unable to set permissions (%s) on %s: %v", unixFileMode, address, err)
|
return nil, fmt.Errorf("unable to set permissions (%s) on %s: %v", unixFileMode, address, err)
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net
|
||||||
}
|
}
|
||||||
|
|
||||||
if IsUnixNetwork(na.Network) {
|
if IsUnixNetwork(na.Network) {
|
||||||
if !isAbtractUnixSocket {
|
if !isAbstractUnixSocket {
|
||||||
if err := os.Chmod(address, unixFileMode); err != nil {
|
if err := os.Chmod(address, unixFileMode); err != nil {
|
||||||
return nil, fmt.Errorf("unable to set permissions (%s) on %s: %v", unixFileMode, address, err)
|
return nil, fmt.Errorf("unable to set permissions (%s) on %s: %v", unixFileMode, address, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,7 @@ func (cl *BaseLog) provisionCommon(ctx Context, logging *Logging) error {
|
||||||
func (cl *BaseLog) buildCore() {
|
func (cl *BaseLog) buildCore() {
|
||||||
// logs which only discard their output don't need
|
// logs which only discard their output don't need
|
||||||
// to perform encoding or any other processing steps
|
// to perform encoding or any other processing steps
|
||||||
// at all, so just shorcut to a nop core instead
|
// at all, so just shortcut to a nop core instead
|
||||||
if _, ok := cl.writerOpener.(*DiscardWriter); ok {
|
if _, ok := cl.writerOpener.(*DiscardWriter); ok {
|
||||||
cl.core = zapcore.NewNopCore()
|
cl.core = zapcore.NewNopCore()
|
||||||
return
|
return
|
||||||
|
|
|
@ -132,7 +132,7 @@ type browseTemplateContext struct {
|
||||||
// The full path of the request.
|
// The full path of the request.
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
|
|
||||||
// Whether the parent directory is browseable.
|
// Whether the parent directory is browsable.
|
||||||
CanGoUp bool `json:"can_go_up"`
|
CanGoUp bool `json:"can_go_up"`
|
||||||
|
|
||||||
// The items (files and folders) in the path.
|
// The items (files and folders) in the path.
|
||||||
|
|
|
@ -184,7 +184,7 @@ type RespHeaderOps struct {
|
||||||
Require *caddyhttp.ResponseMatcher `json:"require,omitempty"`
|
Require *caddyhttp.ResponseMatcher `json:"require,omitempty"`
|
||||||
|
|
||||||
// If true, header operations will be deferred until
|
// If true, header operations will be deferred until
|
||||||
// they are written out. Superceded if Require is set.
|
// they are written out. Superseded if Require is set.
|
||||||
// Usually you will need to set this to true if any
|
// Usually you will need to set this to true if any
|
||||||
// fields are being deleted.
|
// fields are being deleted.
|
||||||
Deferred bool `json:"deferred,omitempty"`
|
Deferred bool `json:"deferred,omitempty"`
|
||||||
|
|
|
@ -274,7 +274,7 @@ func parseIPZoneFromString(address string) (netip.Addr, string, error) {
|
||||||
ipStr = address // OK; probably didn't have a port
|
ipStr = address // OK; probably didn't have a port
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some IPv6-Adresses can contain zone identifiers at the end,
|
// Some IPv6-Addresses can contain zone identifiers at the end,
|
||||||
// which are separated with "%"
|
// which are separated with "%"
|
||||||
zoneID := ""
|
zoneID := ""
|
||||||
if strings.Contains(ipStr, "%") {
|
if strings.Contains(ipStr, "%") {
|
||||||
|
|
|
@ -161,7 +161,7 @@ func init() {
|
||||||
// Renders the given Markdown text as HTML and returns it. This uses the
|
// Renders the given Markdown text as HTML and returns it. This uses the
|
||||||
// [Goldmark](https://github.com/yuin/goldmark) library,
|
// [Goldmark](https://github.com/yuin/goldmark) library,
|
||||||
// which is CommonMark compliant. It also has these extensions
|
// which is CommonMark compliant. It also has these extensions
|
||||||
// enabled: Github Flavored Markdown, Footnote, and syntax
|
// enabled: GitHub Flavored Markdown, Footnote, and syntax
|
||||||
// highlighting provided by [Chroma](https://github.com/alecthomas/chroma).
|
// highlighting provided by [Chroma](https://github.com/alecthomas/chroma).
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
|
|
@ -97,7 +97,7 @@ type AutomationPolicy struct {
|
||||||
SubjectsRaw []string `json:"subjects,omitempty"`
|
SubjectsRaw []string `json:"subjects,omitempty"`
|
||||||
|
|
||||||
// The modules that may issue certificates. Default: internal if all
|
// The modules that may issue certificates. Default: internal if all
|
||||||
// subjects do not qualify for public certificates; othewise acme and
|
// subjects do not qualify for public certificates; otherwise acme and
|
||||||
// zerossl.
|
// zerossl.
|
||||||
IssuersRaw []json.RawMessage `json:"issuers,omitempty" caddy:"namespace=tls.issuance inline_key=module"`
|
IssuersRaw []json.RawMessage `json:"issuers,omitempty" caddy:"namespace=tls.issuance inline_key=module"`
|
||||||
|
|
||||||
|
|
|
@ -547,7 +547,7 @@ func TestTLSConfig_unmarshalCaddyfile(t *testing.T) {
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "setting 'ca' without arguemnt is an error",
|
name: "setting 'ca' without argument is an error",
|
||||||
args: args{
|
args: args{
|
||||||
d: caddyfile.NewTestDispenser(`{
|
d: caddyfile.NewTestDispenser(`{
|
||||||
ca
|
ca
|
||||||
|
@ -710,7 +710,7 @@ func TestHTTPCertPoolUnmarshalCaddyfile(t *testing.T) {
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "endpoints defiend inline and in block are merged",
|
name: "endpoints defined inline and in block are merged",
|
||||||
args: args{
|
args: args{
|
||||||
d: caddyfile.NewTestDispenser(`http http://localhost/ca-certs {
|
d: caddyfile.NewTestDispenser(`http http://localhost/ca-certs {
|
||||||
endpoints http://remotehost/ca-certs
|
endpoints http://remotehost/ca-certs
|
||||||
|
@ -722,7 +722,7 @@ func TestHTTPCertPoolUnmarshalCaddyfile(t *testing.T) {
|
||||||
wantErr: false,
|
wantErr: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "multiple endpoints defiend in block on the same line",
|
name: "multiple endpoints defined in block on the same line",
|
||||||
args: args{
|
args: args{
|
||||||
d: caddyfile.NewTestDispenser(`http {
|
d: caddyfile.NewTestDispenser(`http {
|
||||||
endpoints http://remotehost/ca-certs http://localhost/ca-certs
|
endpoints http://remotehost/ca-certs http://localhost/ca-certs
|
||||||
|
|
|
@ -517,7 +517,7 @@ func (ca *ClientAuthentication) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
|
||||||
|
|
||||||
_, ok := unm.(ClientCertificateVerifier)
|
_, ok := unm.(ClientCertificateVerifier)
|
||||||
if !ok {
|
if !ok {
|
||||||
return d.Errf("module '%s' is not a caddytls.ClientCertificatVerifier", modID)
|
return d.Errf("module '%s' is not a caddytls.ClientCertificateVerifier", modID)
|
||||||
}
|
}
|
||||||
ca.VerifiersRaw = append(ca.VerifiersRaw, caddyconfig.JSONModuleObject(unm, "verifier", vType, nil))
|
ca.VerifiersRaw = append(ca.VerifiersRaw, caddyconfig.JSONModuleObject(unm, "verifier", vType, nil))
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (iss *InternalIssuer) Provision(ctx caddy.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// IssuerKey returns the unique issuer key for the
|
// IssuerKey returns the unique issuer key for the
|
||||||
// confgured CA endpoint.
|
// configured CA endpoint.
|
||||||
func (iss InternalIssuer) IssuerKey() string {
|
func (iss InternalIssuer) IssuerKey() string {
|
||||||
return iss.ca.ID
|
return iss.ca.ID
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (m MatchRemoteIP) Match(hello *tls.ClientHelloInfo) bool {
|
||||||
}
|
}
|
||||||
ipAddr, err := netip.ParseAddr(ipStr)
|
ipAddr, err := netip.ParseAddr(ipStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.logger.Error("invalid client IP addresss", zap.String("ip", ipStr))
|
m.logger.Error("invalid client IP address", zap.String("ip", ipStr))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return (len(m.cidrs) == 0 || m.matches(ipAddr, m.cidrs)) &&
|
return (len(m.cidrs) == 0 || m.matches(ipAddr, m.cidrs)) &&
|
||||||
|
@ -185,7 +185,7 @@ func (m MatchLocalIP) Match(hello *tls.ClientHelloInfo) bool {
|
||||||
}
|
}
|
||||||
ipAddr, err := netip.ParseAddr(ipStr)
|
ipAddr, err := netip.ParseAddr(ipStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.logger.Error("invalid local IP addresss", zap.String("ip", ipStr))
|
m.logger.Error("invalid local IP address", zap.String("ip", ipStr))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return (len(m.cidrs) == 0 || m.matches(ipAddr, m.cidrs))
|
return (len(m.cidrs) == 0 || m.matches(ipAddr, m.cidrs))
|
||||||
|
|
Loading…
Reference in a new issue