middleware/proxy: Kill goroutines on stop (#646)

* middleware/proxy: Kill goroutines on stop

Ports caddy's 59bf71c293

Excludes the proxy_test.go test part though.

Fixes #644

* Add tests
This commit is contained in:
Miek Gieben 2017-04-26 10:58:14 +01:00 committed by GitHub
parent 003b1bf678
commit 3b5b6a233f
5 changed files with 112 additions and 5 deletions

View file

@ -46,6 +46,8 @@ type Upstream interface {
IsAllowedDomain(string) bool
// Exchanger returns the exchanger to be used for this upstream.
Exchanger() Exchanger
// Stops the upstream from proxying requests to shutdown goroutines cleanly.
Stop() error
}
// UpstreamHostDownFunc can be used to customize how Down behaves.