summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/facebookgo/httpdown/httpdown_example/main.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-08-06 21:47:05 +0200
committerWim <wim@42.be>2018-08-06 21:47:05 +0200
commit51062863a5c34d81e296cf15c61140911037cf3b (patch)
tree9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/facebookgo/httpdown/httpdown_example/main.go
parent4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff)
downloadmatterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2
matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/facebookgo/httpdown/httpdown_example/main.go')
-rw-r--r--vendor/github.com/facebookgo/httpdown/httpdown_example/main.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/vendor/github.com/facebookgo/httpdown/httpdown_example/main.go b/vendor/github.com/facebookgo/httpdown/httpdown_example/main.go
deleted file mode 100644
index 9e3c0bff..00000000
--- a/vendor/github.com/facebookgo/httpdown/httpdown_example/main.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "net/http"
- "os"
- "time"
-
- "github.com/facebookgo/httpdown"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
- duration, err := time.ParseDuration(r.FormValue("duration"))
- if err != nil {
- http.Error(w, err.Error(), 400)
- return
- }
- fmt.Fprintf(w, "going to sleep %s with pid %d\n", duration, os.Getpid())
- w.(http.Flusher).Flush()
- time.Sleep(duration)
- fmt.Fprintf(w, "slept %s with pid %d\n", duration, os.Getpid())
-}
-
-func main() {
- server := &http.Server{
- Addr: "127.0.0.1:8080",
- Handler: http.HandlerFunc(handler),
- }
- hd := &httpdown.HTTP{
- StopTimeout: 10 * time.Second,
- KillTimeout: 1 * time.Second,
- }
-
- flag.StringVar(&server.Addr, "addr", server.Addr, "http address")
- flag.DurationVar(&hd.StopTimeout, "stop-timeout", hd.StopTimeout, "stop timeout")
- flag.DurationVar(&hd.KillTimeout, "kill-timeout", hd.KillTimeout, "kill timeout")
- flag.Parse()
-
- if err := httpdown.ListenAndServe(server, hd); err != nil {
- panic(err)
- }
-}