Merge pull request #31 from harshavardhana/pr_out_disable_tls_for_now

This commit is contained in:
Harshavardhana
2015-02-05 21:31:32 -08:00
4 changed files with 27 additions and 15 deletions
+12 -12
View File
@@ -29,17 +29,17 @@ func doMinioConfigure(c *cli.Context) {
log.Fatal("Invalid hostname")
}
certFile := c.String("cert")
if certFile == "" {
log.Fatal("invalid certificate")
}
keyFile := c.String("key")
if keyFile == "" {
log.Fatal("invalid key")
}
/*
certFile := c.String("cert")
if certFile == "" {
log.Fatal("invalid certificate")
}
keyFile := c.String("key")
if keyFile == "" {
log.Fatal("invalid key")
}
var accessKey, secretKey string
var err error
accessKey, secretKey, err = parseConfigureInput(c)
@@ -51,8 +51,8 @@ func doMinioConfigure(c *cli.Context) {
// AccessKey: accessKey,
// SecretAccessKey: secretKey,
Hostname: hostname,
CertPEM: certFile,
KeyPEM: keyFile,
// CertPEM: certFile,
// KeyPEM: keyFile,
}
jAuth, err := json.Marshal(auth)
+1 -1
View File
@@ -105,7 +105,7 @@ var MinioConfigure = cli.Command{
Name: "configure",
Usage: "",
Description: `Configure minio client configuration data. If your config
file does not exist (the default location is ~/.s3auth), it will be
file does not exist (the default location is ~/.auth), it will be
automatically created for you. Note that the configure command only writes
values to the config file. It does not use any configuration values from
the environment variables.`,
+12
View File
@@ -3,7 +3,9 @@ package minio
import (
"crypto/tls"
"io/ioutil"
"net"
"net/http"
"time"
)
type Auth struct {
@@ -35,6 +37,16 @@ func (a *Auth) loadKeys(cert string, key string) (*TlsConfig, error) {
}
func (a *Auth) getTlsTransport() (*http.Transport, error) {
if a.CertPEM == "" || a.KeyPEM == "" {
return &http.Transport{
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
}, nil
}
tlsconfig, err := a.loadKeys(a.CertPEM, a.KeyPEM)
if err != nil {
return nil, err
+2 -2
View File
@@ -67,7 +67,7 @@ func (c *Client) hostname() string {
// bucketURL returns the URL prefix of the bucket, with trailing slash
func (c *Client) bucketURL(bucket string) string {
return fmt.Sprintf("https://%s/%s/", c.hostname(), bucket)
return fmt.Sprintf("http://%s/%s/", c.hostname(), bucket)
}
func (c *Client) keyURL(bucket, key string) string {
@@ -84,7 +84,7 @@ func newReq(url_ string) *http.Request {
}
func (c *Client) Buckets() ([]*Bucket, error) {
req := newReq("https://" + c.hostname() + "/")
req := newReq("http://" + c.hostname() + "/")
res, err := c.transport().RoundTrip(req)
if err != nil {
return nil, err