From 98c730e8247aa4dc5b3a0d8419e9d5d004dc2397 Mon Sep 17 00:00:00 2001 From: Seednode Date: Mon, 15 Jan 2024 09:41:11 -0600 Subject: [PATCH] Set default concurrency to 1024, simplify setting Content-Length header --- cmd/root.go | 4 ++-- cmd/web.go | 8 +------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index f911871..a5c2edb 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,7 +17,7 @@ import ( const ( AllowedCharacters string = `^[A-z0-9.\-_]+$` - ReleaseVersion string = "6.1.0" + ReleaseVersion string = "6.1.1" ) var ( @@ -123,7 +123,7 @@ func init() { rootCmd.Flags().BoolVar(&CaseSensitive, "case-sensitive", false, "use case-sensitive matching for filters") rootCmd.Flags().BoolVar(&Code, "code", false, "enable support for source code files") rootCmd.Flags().StringVar(&CodeTheme, "code-theme", "solarized-dark256", "theme for source code syntax highlighting") - rootCmd.Flags().IntVar(&Concurrency, "concurrency", 10240, "maximum concurrency for scan threads") + rootCmd.Flags().IntVar(&Concurrency, "concurrency", 1024, "maximum concurrency for scan threads") rootCmd.Flags().BoolVarP(&Debug, "debug", "d", false, "display even more verbose logs") rootCmd.Flags().BoolVar(&DisableButtons, "disable-buttons", false, "disable first/prev/next/last buttons") rootCmd.Flags().BoolVar(&ExitOnError, "exit-on-error", false, "shut down webserver on error, instead of just printing error") diff --git a/cmd/web.go b/cmd/web.go index 836d793..f105e3f 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -5,7 +5,6 @@ Copyright © 2024 Seednode package cmd import ( - "bytes" "errors" "fmt" "io" @@ -425,12 +424,7 @@ func serveVersion(errorChannel chan<- error) httprouter.Handle { data := []byte(fmt.Sprintf("roulette v%s\n", ReleaseVersion)) - err := w.Header().Write(bytes.NewBufferString("Content-Length: " + strconv.Itoa(len(data)))) - if err != nil { - errorChannel <- err - - return - } + w.Header().Set("Content-Length", strconv.Itoa(len(data))) written, err := w.Write(data) if err != nil {