Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Fix Nil Pointer Panic on
osExecCommand.ProcessState(execShellCommand):$PATHwhen-shell=""is configured, invalid permissions, or bad executable path),osExecCommand.ProcessStateremainsnil.osExecCommand.ProcessState.ExitCode()previously caused an unhandled nil pointer dereference panic, taking down the HTTP server process.osExecCommand.ProcessStateand fallback exit code1whenerr != nil.Improve CGI Specification (RFC 3875) Compliance (
setCGIEnv):headerValue[0]was used, silently discarding remaining values. Now joined usingstrings.Join(headerValue, ", ").CONTENT_LENGTH&CONTENT_TYPE: Added standard CGI environment variables fromreq.ContentLengthandreq.Header.Get("Content-Type").REMOTE_ADDR: Ifnet.SplitHostPort(req.RemoteAddr)fails (e.g. Unix domain socket or raw IP), fall back toreq.RemoteAddrinstead of leavingremoteHostempty.Test Improvements:
"/dev/null"in tests with cross-platformos.DevNull.Test_execShellCommand_ProcessStateNilto ensure non-existent commands fail gracefully without panicking.Test_setCGIEnv_MultiHeadersAndContentto verify multi-value headers, content length, and content type environment variables.Verification
go test -v ./...passed.GOARCH=386 go test ./...passed.go vet ./...passed cleanly.gofmt -d .passed with 0 diffs.