diff options
author | Wim <wim@42.be> | 2017-06-06 00:01:05 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2017-06-06 00:04:18 +0200 |
commit | 3a183cb218c6812964a70d2e75884ad7071d9c0c (patch) | |
tree | ee0d2492c27e84ace88acfcfdc533545f42ccb21 /vendor/github.com/labstack/echo/cookbook/http2/server.go | |
parent | 2eecaccd1c77e8990a80e6b4b6ad6b13a9c95896 (diff) | |
download | matterbridge-msglm-3a183cb218c6812964a70d2e75884ad7071d9c0c.tar.gz matterbridge-msglm-3a183cb218c6812964a70d2e75884ad7071d9c0c.tar.bz2 matterbridge-msglm-3a183cb218c6812964a70d2e75884ad7071d9c0c.zip |
Update vendor
Diffstat (limited to 'vendor/github.com/labstack/echo/cookbook/http2/server.go')
-rw-r--r-- | vendor/github.com/labstack/echo/cookbook/http2/server.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/vendor/github.com/labstack/echo/cookbook/http2/server.go b/vendor/github.com/labstack/echo/cookbook/http2/server.go deleted file mode 100644 index 8db989c4..00000000 --- a/vendor/github.com/labstack/echo/cookbook/http2/server.go +++ /dev/null @@ -1,42 +0,0 @@ -package main - -import ( - "fmt" - "net/http" - "time" - - "github.com/labstack/echo" -) - -func request(c echo.Context) error { - req := c.Request() - format := "<pre><strong>Request Information</strong>\n\n<code>Protocol: %s\nHost: %s\nRemote Address: %s\nMethod: %s\nPath: %s\n</code></pre>" - return c.HTML(http.StatusOK, fmt.Sprintf(format, req.Proto, req.Host, req.RemoteAddr, req.Method, req.URL.Path)) -} - -func stream(c echo.Context) error { - res := c.Response() - gone := res.CloseNotify() - res.Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) - res.WriteHeader(http.StatusOK) - ticker := time.NewTicker(1 * time.Second) - defer ticker.Stop() - - fmt.Fprint(res, "<pre><strong>Clock Stream</strong>\n\n<code>") - for { - fmt.Fprintf(res, "%v\n", time.Now()) - res.Flush() - select { - case <-ticker.C: - case <-gone: - break - } - } -} - -func main() { - e := echo.New() - e.GET("/request", request) - e.GET("/stream", stream) - e.Logger.Fatal(e.StartTLS(":1323", "cert.pem", "key.pem")) -} |