dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 2be2875e442046c6e26b00f5f0da51cb4487dea1
parent c9c7b997bd5319980e2a6989fdec5bde493062af
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 29 May 2023 02:57:31 -0700

move code

Diffstat:
Mpkg/web/handlers/handlers.go | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -5043,6 +5043,12 @@ func ChatStreamMessagesHandler(c echo.Context) error { return c.Redirect(http.StatusFound, "/") } + // Setup headers for http request + c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) + c.Response().WriteHeader(http.StatusOK) + c.Response().Header().Set("Transfer-Encoding", "chunked") + c.Response().Header().Set("Connection", "keep-alive") + quit := closeSignalChan(c) // Keep track of users streams, so we can limit how many are open at one time per user @@ -5051,11 +5057,6 @@ func ChatStreamMessagesHandler(c echo.Context) error { } defer usersStreamsManager.Remove(authUser.ID) - c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) - c.Response().WriteHeader(http.StatusOK) - c.Response().Header().Set("Transfer-Encoding", "chunked") - c.Response().Header().Set("Connection", "keep-alive") - // Keep track of how many bytes we sent on the http request, so we can auto-refresh when passing a threshold bytesSent := 0 send := func(s string) {