0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Abiola Ibrahim 2015-06-30 17:31:40 +01:00
commit aecdecbdf8
2 changed files with 8 additions and 2 deletions

View file

@ -2,7 +2,7 @@
[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/mholt/caddy) [![Build Status](https://img.shields.io/travis/mholt/caddy.svg?style=flat-square)](https://travis-ci.org/mholt/caddy) [![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/mholt/caddy) [![Build Status](https://img.shields.io/travis/mholt/caddy.svg?style=flat-square)](https://travis-ci.org/mholt/caddy)
Caddy is a lightweight, general-purpose web server for Windows, Mac, Linux, BSD, and [Android](https://github.com/mholt/caddy/wiki/Running-Caddy-on-Android). It is a capable alternative to other popular web servers that is easy to use. Caddy is a lightweight, general-purpose web server for Windows, Mac, Linux, BSD, and [Android](https://github.com/mholt/caddy/wiki/Running-Caddy-on-Android). It is a capable alternative to other popular and easy to use web servers.
The most notable features are HTTP/2, Virtual Hosts, TLS + SNI, and easy configuration with a [Caddyfile](https://caddyserver.com/docs/caddyfile). Usually, you have one Caddyfile per site. Most directives for the Caddyfile invoke a layer of middleware which can be [used in your own Go programs](https://github.com/mholt/caddy/wiki/Using-Caddy-Middleware-in-Your-Own-Programs). The most notable features are HTTP/2, Virtual Hosts, TLS + SNI, and easy configuration with a [Caddyfile](https://caddyserver.com/docs/caddyfile). Usually, you have one Caddyfile per site. Most directives for the Caddyfile invoke a layer of middleware which can be [used in your own Go programs](https://github.com/mholt/caddy/wiki/Using-Caddy-Middleware-in-Your-Own-Programs).

View file

@ -176,7 +176,6 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
"CONTENT_TYPE": r.Header.Get("Content-Type"), "CONTENT_TYPE": r.Header.Get("Content-Type"),
"GATEWAY_INTERFACE": "CGI/1.1", "GATEWAY_INTERFACE": "CGI/1.1",
"PATH_INFO": pathInfo, "PATH_INFO": pathInfo,
"PATH_TRANSLATED": filepath.Join(h.AbsRoot, pathInfo), // Info: http://www.oreilly.com/openbook/cgi/ch02_04.html
"QUERY_STRING": r.URL.RawQuery, "QUERY_STRING": r.URL.RawQuery,
"REMOTE_ADDR": ip, "REMOTE_ADDR": ip,
"REMOTE_HOST": ip, // For speed, remote host lookups disabled "REMOTE_HOST": ip, // For speed, remote host lookups disabled
@ -198,6 +197,13 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
"SCRIPT_NAME": scriptName, "SCRIPT_NAME": scriptName,
} }
// compliance with the CGI specification that PATH_TRANSLATED
// should only exist if PATH_INFO is defined.
// Info: https://www.ietf.org/rfc/rfc3875 Page 14
if env["PATH_INFO"] != "" {
env["PATH_TRANSLATED"] = filepath.Join(h.AbsRoot, pathInfo) // Info: http://www.oreilly.com/openbook/cgi/ch02_04.html
}
// Add env variables from config // Add env variables from config
for _, envVar := range rule.EnvVars { for _, envVar := range rule.EnvVars {
env[envVar[0]] = envVar[1] env[envVar[0]] = envVar[1]