From 0712f0b78ca7a9f301ba14e5813755977b1f266f Mon Sep 17 00:00:00 2001 From: Mzack9999 Date: Sat, 17 Apr 2021 20:45:12 +0200 Subject: [PATCH 1/3] fixing crash in #27 --- pkg/httpserver/httpserver.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/httpserver/httpserver.go b/pkg/httpserver/httpserver.go index 1747017..d516caf 100644 --- a/pkg/httpserver/httpserver.go +++ b/pkg/httpserver/httpserver.go @@ -32,12 +32,13 @@ func New(options *Options) (*HTTPServer, error) { var h HTTPServer EnableUpload = options.EnableUpload EnableVerbose = options.Verbose - layers := h.loglayer(http.FileServer(http.Dir(options.Folder))) + h.layers = h.loglayer(http.FileServer(http.Dir(options.Folder))) if options.BasicAuthUsername != "" || options.BasicAuthPassword != "" { - layers = h.loglayer(h.basicauthlayer(http.FileServer(http.Dir(options.Folder)))) + h.layers = h.loglayer(h.basicauthlayer(http.FileServer(http.Dir(options.Folder)))) } + h.options = options - return &HTTPServer{options: options, layers: layers}, nil + return &h, nil } // ListenAndServe requests over http From 435e88ce9662a905bca7f3f28cf8ca885bcfcc8a Mon Sep 17 00:00:00 2001 From: sandeep <8293321+ehsandeep@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:04:11 +0530 Subject: [PATCH 2/3] version update --- internal/runner/banner.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/runner/banner.go b/internal/runner/banner.go index f727190..a6b729d 100644 --- a/internal/runner/banner.go +++ b/internal/runner/banner.go @@ -8,11 +8,11 @@ const banner = ` \__ \/ / __ -__ \/ __ \/ / _ \/ /_/ / / / / / / /_/ / ___/ _ \/ ___/ | / / _ \/ ___/ ___/ / / / / / / / /_/ / / __/ __ / / / / / / ____(__ ) __/ / | |/ / __/ / /____/_/_/ /_/ /_/ .___/_/\___/_/ /_/ /_/ /_/ /_/ /____/\___/_/ |___/\___/_/ - /_/ - v0.0.2 + /_/ - v0.0.3 ` // Version is the current version -const Version = `0.0.2` +const Version = `0.0.3` // showBanner is used to show the banner to the user func showBanner() { From 4db054d50bc81dfe3c18d1b2192f8cd160144677 Mon Sep 17 00:00:00 2001 From: sandeep <8293321+ehsandeep@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:06:20 +0530 Subject: [PATCH 3/3] Update Dockerfile --- Dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ebec407..806904b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,7 @@ -FROM golang:1.16-alpine AS builder -RUN apk add --no-cache git +FROM golang:1.16-alpine as build-env RUN GO111MODULE=on go get -v github.com/projectdiscovery/simplehttpserver/cmd/simplehttpserver FROM alpine:latest RUN apk add --no-cache bind-tools ca-certificates -COPY --from=builder /go/bin/simplehttpserver /usr/local/bin/ - -ENTRYPOINT ["simplehttpserver"] +COPY --from=build-env /go/bin/simplehttpserver /usr/local/bin/simplehttpserver +ENTRYPOINT ["simplehttpserver"] \ No newline at end of file