Skip to content
This repository has been archived by the owner on Mar 20, 2023. It is now read-only.

Commit

Permalink
Reinstate remote user for versions of Caddy after 0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-kurt committed Mar 30, 2017
1 parent a8a85cb commit 473e48a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 23 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,6 @@ script may use a different method to read POST content. Secondly, the
and contains the entire command line, including all arguments, with which the
CGI script was executed.

**Note**: The basicauth plugin for Caddy 0.9.5 and earlier does not provide
remote user information to other middleware such as this CGI plugin. To use the
REMOTE_USER environment variable, you need to wait for Caddy 0.10.0 or build
your Caddy executable from the current source tree.

When a browser requests

http://192.168.1.2:8080/show/weekly?mode=summary
Expand Down
7 changes: 4 additions & 3 deletions cgi.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ func (h handlerType) ServeHTTP(w http.ResponseWriter, r *http.Request) (code int
ok, lfStr, rtStr := match(r.URL.Path, matchStr)
if ok {
var buf bytes.Buffer
// Remote user is not available in Caddy 0.9.5. Use a blank string for
// remote user until Caddy 0.10.0.
cgiHnd := setupCall(h, rule, lfStr, rtStr, rep, "")
// Retrieve name of remote user that was set by some downstream middleware,
// possibly basicauth.
remoteUser, _ := r.Context().Value(httpserver.RemoteUserCtxKey).(string) // Blank if not set
cgiHnd := setupCall(h, rule, lfStr, rtStr, rep, remoteUser)
cgiHnd.Stderr = &buf
cgiHnd.ServeHTTP(w, r)
if buf.Len() > 0 {
Expand Down
5 changes: 0 additions & 5 deletions cgi.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,6 @@ script may use a different method to read POST content. Secondly, the
and contains the entire command line, including all arguments, with which the
CGI script was executed.

<mark class="block">**Note**: The basicauth plugin for Caddy 0.9.5 and earlier does not provide
remote user information to other middleware such as this CGI plugin. To use the
REMOTE_USER environment variable, you need to wait for Caddy 0.10.0 or build
your Caddy executable from the current source tree.</mark>

When a browser requests

http://192.168.1.2:8080/show/weekly?mode=summary
Expand Down
5 changes: 0 additions & 5 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ SCRIPT_EXEC variable is not a CGI standard. It is provided by this middleware
and contains the entire command line, including all arguments, with which the
CGI script was executed.
Note: The basicauth plugin for Caddy 0.9.5 and earlier does not provide
remote user information to other middleware such as this CGI plugin. To use the
REMOTE_USER environment variable, you need to wait for Caddy 0.10.0 or build
your Caddy executable from the current source tree.
When a browser requests
http://192.168.1.2:8080/show/weekly?mode=summary
Expand Down
5 changes: 0 additions & 5 deletions doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,6 @@ script may use a different method to read POST content. Secondly, the
and contains the entire command line, including all arguments, with which the
CGI script was executed.

**Note**: The basicauth plugin for Caddy 0.9.5 and earlier does not provide
remote user information to other middleware such as this CGI plugin. To use the
REMOTE_USER environment variable, you need to wait for Caddy 0.10.0 or build
your Caddy executable from the current source tree.

When a browser requests

http://192.168.1.2:8080/show/weekly?mode=summary
Expand Down

0 comments on commit 473e48a

Please sign in to comment.