From 703a2fb6e100d202d1c7fcd052d73bd5affef408 Mon Sep 17 00:00:00 2001 From: komels Date: Fri, 15 Apr 2022 16:53:39 +0300 Subject: Move 'kikimr/yndx'-depending tests out of ydb/core ref:0a380e13308d579e0545a76924330d1ca5129c43 --- library/cpp/http/simple/ut/https_server/main.go | 70 ------------------------- 1 file changed, 70 deletions(-) delete mode 100644 library/cpp/http/simple/ut/https_server/main.go (limited to 'library/cpp/http/simple/ut/https_server/main.go') diff --git a/library/cpp/http/simple/ut/https_server/main.go b/library/cpp/http/simple/ut/https_server/main.go deleted file mode 100644 index 4282810675e..00000000000 --- a/library/cpp/http/simple/ut/https_server/main.go +++ /dev/null @@ -1,70 +0,0 @@ -package main - -import ( - "fmt" - "log" - "net/http" - "os" - - "github.com/spf13/cobra" - "github.com/spf13/pflag" -) - -type Opts struct { - Port uint16 - KeyFile string - CertFile string -} - -func handler(writer http.ResponseWriter, request *http.Request) { - res := "pong.my" - - writer.Header().Set("Content-Type", "text/plain") - writer.WriteHeader(http.StatusOK) - - _, _ = writer.Write([]byte(res)) -} - -func runServer(opts *Opts) error { - mainMux := http.NewServeMux() - mainMux.Handle("/ping", http.HandlerFunc(handler)) - - server := &http.Server{ - Addr: fmt.Sprintf("localhost:%d", opts.Port), - Handler: mainMux, - ErrorLog: log.New(os.Stdout, "", log.LstdFlags), - } - - return server.ListenAndServeTLS(opts.CertFile, opts.KeyFile) -} - -func markFlagRequired(flags *pflag.FlagSet, names ...string) { - for _, n := range names { - name := n - if err := cobra.MarkFlagRequired(flags, name); err != nil { - panic(err) - } - } -} - -func main() { - opts := Opts{} - - cmd := cobra.Command{ - RunE: func(cmd *cobra.Command, args []string) error { - return runServer(&opts) - }, - } - - flags := cmd.Flags() - flags.Uint16Var(&opts.Port, "port", 0, "") - flags.StringVar(&opts.KeyFile, "keyfile", "", "path to key file") - flags.StringVar(&opts.CertFile, "certfile", "", "path to cert file") - - markFlagRequired(flags, "port", "keyfile", "certfile") - - if err := cmd.Execute(); err != nil { - _, _ = fmt.Fprintf(os.Stderr, "Exit with err: %s", err) - os.Exit(1) - } -} -- cgit v1.3