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:
Harshavardhana
2016-05-10 18:03:00 -07:00
parent d1fa1d9352
commit 49141eb3e4
8 changed files with 8 additions and 1045 deletions

View File

@@ -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)
}