mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
http: Remove minhttp package and use standard Golang http. (#1587)
The functionality provided by minhttp will be implemented cleanly through our own APIs. Since we are not going to send SIGUSR2 and manage configuration in that manner, it doesn't make sense to use minhttp. Fixes #1586
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
@@ -30,7 +29,6 @@ import (
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/console"
|
||||
"github.com/minio/minio/pkg/minhttp"
|
||||
)
|
||||
|
||||
var serverCmd = cli.Command{
|
||||
@@ -86,15 +84,6 @@ func configureServer(srvCmdConfig serverCmdConfig) *http.Server {
|
||||
MaxHeaderBytes: 1 << 20,
|
||||
}
|
||||
|
||||
// Configure TLS if certs are available.
|
||||
if isSSL() {
|
||||
var err error
|
||||
apiServer.TLSConfig = &tls.Config{}
|
||||
apiServer.TLSConfig.Certificates = make([]tls.Certificate, 1)
|
||||
apiServer.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(mustGetCertFile(), mustGetKeyFile())
|
||||
fatalIf(err, "Unable to load certificates.", nil)
|
||||
}
|
||||
|
||||
// Returns configured HTTP server.
|
||||
return apiServer
|
||||
}
|
||||
@@ -319,6 +308,13 @@ func serverMain(c *cli.Context) {
|
||||
}
|
||||
|
||||
// Start server.
|
||||
err := minhttp.ListenAndServe(apiServer)
|
||||
var err error
|
||||
// Configure TLS if certs are available.
|
||||
if isSSL() {
|
||||
err = apiServer.ListenAndServeTLS(mustGetCertFile(), mustGetKeyFile())
|
||||
} else {
|
||||
// Fallback to http.
|
||||
err = apiServer.ListenAndServe()
|
||||
}
|
||||
errorIf(err, "Failed to start the minio server.", nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user