caddy/caddyhttp/httpserver
Matt Holt d5371aff22 httpserver/all: Clean up and standardize request URL handling (#1633)
* httpserver/all: Clean up and standardize request URL handling

The HTTP server now always creates a context value on the request which
is a copy of the request's URL struct. It should not be modified by
middlewares, but it is safe to get the value out of the request and make
changes to it locally-scoped. Thus, the value in the context always
stores the original request URL information as it was received. Any
rewrites that happen will be to the request's URL field directly.

The HTTP server no longer cleans /sanitizes the request URL. It made too
many strong assumptions and ended up making a lot of middleware more
complicated, including upstream proxying (and fastcgi). To alleviate
this complexity, we no longer change the request URL. Middlewares are
responsible to access the disk safely by using http.Dir or, if not
actually opening files, they can use httpserver.SafePath().

I'm hoping this will address issues with #1624, #1584, #1582, and others.

* staticfiles: Fix test on Windows

@abiosoft: I still can't figure out exactly what this is for. 😅

* Use (potentially) changed URL for browse redirects, as before

* Use filepath.ToSlash, clean up a couple proxy test cases

* Oops, fix variable name
2017-05-01 23:11:10 -06:00
..
condition_test.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
condition.go Fix small misspellings 2017-01-10 13:09:24 -08:00
error.go proxy: recognize client's cancellation 2017-04-30 10:14:19 +08:00
https_test.go httpserver: Proper HTTP->HTTPS for wildcard sites (fixes #1625) 2017-04-26 12:32:15 -06:00
https.go httpserver: Proper HTTP->HTTPS for wildcard sites (fixes #1625) 2017-04-26 12:32:15 -06:00
logger_test.go Feature #1246 - Remote syslog (#1301) 2017-02-08 08:02:09 -07:00
logger.go httpserver: Don't close stdout or stderr when closing logs (fix #1471) 2017-04-18 16:01:11 -06:00
middleware_test.go Rewrote Caddy from the ground up; initial commit of 0.9 branch 2016-06-04 17:00:29 -06:00
middleware.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
mitm_test.go Added Const for use of CtxKeys (#1511) 2017-03-13 09:22:46 -06:00
mitm.go lint fixes 2017-04-29 20:53:58 -04:00
path.go Proposal: Middleware Config (#908) 2016-07-08 18:12:52 -06:00
plugin_test.go Bugfix for issue #1628 where Caddyfile is not being hidden correctly on windows. 2017-05-01 14:21:49 +01:00
plugin.go Bugfix for issue #1628 where Caddyfile is not being hidden correctly on windows. 2017-05-01 14:21:49 +01:00
recorder_test.go Rewrote Caddy from the ground up; initial commit of 0.9 branch 2016-06-04 17:00:29 -06:00
recorder.go proxy: recognize client's cancellation 2017-04-30 10:14:19 +08:00
replacer_test.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
replacer.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
roller.go Roll all logs by default (#1379) 2017-02-08 09:23:33 -07:00
server_test.go tls: Refactor internals related to TLS configurations (#1466) 2017-02-21 09:49:22 -07:00
server.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
siteconfig.go Add proxyprotocol directive and listener middleware plugin type (#1349) 2017-03-09 22:31:37 -07:00
tplcontext_test.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
tplcontext.go httpserver/all: Clean up and standardize request URL handling (#1633) 2017-05-01 23:11:10 -06:00
vhosttrie_test.go Rewrote Caddy from the ground up; initial commit of 0.9 branch 2016-06-04 17:00:29 -06:00
vhosttrie.go Don't treat localhost specially when assigning bind address 2016-06-27 13:14:28 -06:00