Skip to content

Commit 49d7380

Browse files
authored
chore(caddy): modernize for Go 1.26 (#2183)
1 parent 040ce55 commit 49d7380

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

caddy/module.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ func (f *FrankenPHPModule) Provision(ctx caddy.Context) error {
108108
} else {
109109
f.Root = filepath.Join(frankenphp.EmbeddedAppPath, defaultDocumentRoot)
110110

111-
var rrs bool
112-
f.ResolveRootSymlink = &rrs
111+
f.ResolveRootSymlink = new(false)
113112
}
114113
} else if frankenphp.EmbeddedAppPath != "" && filepath.IsLocal(f.Root) {
115114
f.Root = filepath.Join(frankenphp.EmbeddedAppPath, f.Root)
@@ -126,8 +125,7 @@ func (f *FrankenPHPModule) Provision(ctx caddy.Context) error {
126125
}
127126

128127
if f.ResolveRootSymlink == nil {
129-
rrs := true
130-
f.ResolveRootSymlink = &rrs
128+
f.ResolveRootSymlink = new(true)
131129
}
132130

133131
// Always pre-compute absolute file names for fallback matching
@@ -202,7 +200,6 @@ func needReplacement(s string) bool {
202200
// ServeHTTP implements caddyhttp.MiddlewareHandler.
203201
func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error {
204202
ctx := r.Context()
205-
origReq := ctx.Value(caddyhttp.OriginalRequestCtxKey).(http.Request)
206203
repl := ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
207204

208205
documentRoot := f.resolvedDocumentRoot
@@ -243,7 +240,7 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
243240
r,
244241
append(
245242
opts,
246-
frankenphp.WithOriginalRequest(&origReq),
243+
frankenphp.WithOriginalRequest(new(ctx.Value(caddyhttp.OriginalRequestCtxKey).(http.Request))),
247244
frankenphp.WithWorkerName(workerName),
248245
)...,
249246
)
@@ -480,8 +477,7 @@ func parsePhpServer(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error)
480477
if phpsrv.Root == "" {
481478
phpsrv.Root = filepath.Join(frankenphp.EmbeddedAppPath, defaultDocumentRoot)
482479
fsrv.Root = phpsrv.Root
483-
rrs := false
484-
phpsrv.ResolveRootSymlink = &rrs
480+
phpsrv.ResolveRootSymlink = new(false)
485481
} else if filepath.IsLocal(fsrv.Root) {
486482
phpsrv.Root = filepath.Join(frankenphp.EmbeddedAppPath, phpsrv.Root)
487483
fsrv.Root = phpsrv.Root

0 commit comments

Comments
 (0)