mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
lib/httpserver: move ServeWithOpts to Serve
This addresses that todo in the codebase, and updates all callsites to the new signature. --------- Signed-off-by: Florian Klink <flokli@flokli.de>
This commit is contained in:
@@ -102,35 +102,7 @@ type ServeOptions struct {
|
||||
// Serve starts an http server on the given addrs with the given optional rh.
|
||||
//
|
||||
// By default all the responses are transparently compressed, since egress traffic is usually expensive.
|
||||
//
|
||||
// The compression can be disabled by specifying -http.disableResponseCompression command-line flag.
|
||||
//
|
||||
// If useProxyProtocol is set to true for the corresponding addr, then the incoming connections are accepted via proxy protocol.
|
||||
// See https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
|
||||
func Serve(addrs []string, useProxyProtocol *flagutil.ArrayBool, rh RequestHandler) {
|
||||
if rh == nil {
|
||||
rh = func(_ http.ResponseWriter, _ *http.Request) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
opts := ServeOptions{
|
||||
UseProxyProtocol: useProxyProtocol,
|
||||
}
|
||||
for idx, addr := range addrs {
|
||||
if addr == "" {
|
||||
continue
|
||||
}
|
||||
go serve(addr, rh, idx, opts)
|
||||
}
|
||||
}
|
||||
|
||||
// ServeWithOpts starts an http server on the given addrs with the given optional request handlers.
|
||||
//
|
||||
// By default all the responses are transparently compressed, since egress traffic is usually expensive.
|
||||
//
|
||||
// The compression can be disabled by specifying -http.disableResponseCompression command-line flag.
|
||||
// TODO: rename to Serve and update Serve usage with new signature
|
||||
func ServeWithOpts(addrs []string, rh RequestHandler, opts ServeOptions) {
|
||||
func Serve(addrs []string, rh RequestHandler, opts ServeOptions) {
|
||||
if rh == nil {
|
||||
rh = func(_ http.ResponseWriter, _ *http.Request) bool {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user