From 553779d57473eb03227378edfdf9ade32e24c31b Mon Sep 17 00:00:00 2001 From: Xevion Date: Thu, 28 Dec 2023 13:59:53 -0600 Subject: [PATCH] Remove Keep-Alive headers from ApplyHeader helpers --- helpers.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helpers.go b/helpers.go index 319d3de..536e2f5 100644 --- a/helpers.go +++ b/helpers.go @@ -9,9 +9,10 @@ import ( ) // DoRequestNoRead makes a request and returns the response -// Compared to DoRequest, this function does not read the response body -// This function encapsulates the boilerplate for logging +// Compared to DoRequest, this function does not read the response body, and it uses the Content-Length header for the associated log attribute. +// This function encapsulates the boilerplate for logging. func DoRequestNoRead(req *http.Request) (*http.Response, error) { + // Log the request log.Debug().Str("method", req.Method).Str("host", req.Host).Str("path", req.URL.Path).Msg("Request") start := time.Now() @@ -64,7 +65,6 @@ func DoRequest(req *http.Request) (*http.Response, []byte, error) { // ApplySclaHeaders applies headers to a request for thescla.org func ApplySclaHeaders(req *http.Request) { req.Header.Set("Origin", "http://www2.thescla.org") - req.Header.Set("Connection", "keep-alive") req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0") req.Header.Set("Accept", "application/json, text/javascript, */*; q=0.01") req.Header.Set("Accept-Language", "en-US,en;q=0.5") @@ -73,7 +73,6 @@ func ApplySclaHeaders(req *http.Request) { // ApplyUtsaHeaders applies headers to a request for utsa.edu func ApplyUtsaHeaders(req *http.Request) { - req.Header.Set("Connection", "keep-alive") req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0") req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8") req.Header.Set("Accept-Language", "en-US,en;q=0.5")