forked from TrueCloudLab/restic
Update dependencies
This commit is contained in:
parent
f3b49987f8
commit
fda563d606
926 changed files with 189726 additions and 98666 deletions
3
vendor/github.com/ncw/swift/auth_v3.go
generated
vendored
3
vendor/github.com/ncw/swift/auth_v3.go
generated
vendored
|
@ -117,7 +117,7 @@ func (auth *v3Auth) Request(c *Connection) (*http.Request, error) {
|
|||
|
||||
v3 := v3AuthRequest{}
|
||||
|
||||
if c.UserName == "" {
|
||||
if c.UserName == "" && c.UserId == "" {
|
||||
v3.Auth.Identity.Methods = []string{v3AuthMethodToken}
|
||||
v3.Auth.Identity.Token = &v3AuthToken{Id: c.ApiKey}
|
||||
} else {
|
||||
|
@ -125,6 +125,7 @@ func (auth *v3Auth) Request(c *Connection) (*http.Request, error) {
|
|||
v3.Auth.Identity.Password = &v3AuthPassword{
|
||||
User: v3User{
|
||||
Name: c.UserName,
|
||||
Id: c.UserId,
|
||||
Password: c.ApiKey,
|
||||
},
|
||||
}
|
||||
|
|
5
vendor/github.com/ncw/swift/swift.go
generated
vendored
5
vendor/github.com/ncw/swift/swift.go
generated
vendored
|
@ -99,6 +99,7 @@ type Connection struct {
|
|||
Domain string // User's domain name
|
||||
DomainId string // User's domain Id
|
||||
UserName string // UserName for api
|
||||
UserId string // User Id
|
||||
ApiKey string // Key for api access
|
||||
AuthUrl string // Auth URL
|
||||
Retries int // Retries on error (default is 3)
|
||||
|
@ -191,6 +192,7 @@ func setFromEnv(param interface{}, name string) (err error) {
|
|||
// For v3 authentication
|
||||
// OS_AUTH_URL - Auth URL
|
||||
// OS_USERNAME - UserName for api
|
||||
// OS_USER_ID - User Id
|
||||
// OS_PASSWORD - Key for api access
|
||||
// OS_USER_DOMAIN_NAME - User's domain name
|
||||
// OS_USER_DOMAIN_ID - User's domain Id
|
||||
|
@ -223,6 +225,7 @@ func (c *Connection) ApplyEnvironment() (err error) {
|
|||
{&c.Domain, "OS_USER_DOMAIN_NAME"},
|
||||
{&c.DomainId, "OS_USER_DOMAIN_ID"},
|
||||
{&c.UserName, "OS_USERNAME"},
|
||||
{&c.UserId, "OS_USER_ID"},
|
||||
{&c.ApiKey, "OS_PASSWORD"},
|
||||
{&c.AuthUrl, "OS_AUTH_URL"},
|
||||
{&c.Retries, "GOSWIFT_RETRIES"},
|
||||
|
@ -284,6 +287,7 @@ type errorMap map[int]error
|
|||
|
||||
var (
|
||||
// Specific Errors you might want to check for equality
|
||||
NotModified = newError(304, "Not Modified")
|
||||
BadRequest = newError(400, "Bad Request")
|
||||
AuthorizationFailed = newError(401, "Authorization Failed")
|
||||
ContainerNotFound = newError(404, "Container Not Found")
|
||||
|
@ -311,6 +315,7 @@ var (
|
|||
|
||||
// Mappings for object errors
|
||||
objectErrorMap = errorMap{
|
||||
304: NotModified,
|
||||
400: BadRequest,
|
||||
403: Forbidden,
|
||||
404: ObjectNotFound,
|
||||
|
|
1
vendor/github.com/ncw/swift/swift_internal_test.go
generated
vendored
1
vendor/github.com/ncw/swift/swift_internal_test.go
generated
vendored
|
@ -576,6 +576,7 @@ func TestApplyEnvironmentAll(t *testing.T) {
|
|||
{1, &c.Domain, "OS_USER_DOMAIN_NAME", "os_user_domain_name", "os_user_domain_name", ""},
|
||||
{1, &c.DomainId, "OS_USER_DOMAIN_ID", "os_user_domain_id", "os_user_domain_id", ""},
|
||||
{1, &c.UserName, "OS_USERNAME", "os_username", "os_username", ""},
|
||||
{1, &c.UserId, "OS_USER_ID", "os_user_id", "os_user_id", ""},
|
||||
{1, &c.ApiKey, "OS_PASSWORD", "os_password", "os_password", ""},
|
||||
{1, &c.AuthUrl, "OS_AUTH_URL", "os_auth_url", "os_auth_url", ""},
|
||||
{1, &c.Retries, "GOSWIFT_RETRIES", "4", 4, ""},
|
||||
|
|
11
vendor/github.com/ncw/swift/swift_test.go
generated
vendored
11
vendor/github.com/ncw/swift/swift_test.go
generated
vendored
|
@ -1077,6 +1077,17 @@ func TestObjectOpenLength(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestObjectOpenNotModified(t *testing.T) {
|
||||
c, rollback := makeConnectionWithObject(t)
|
||||
defer rollback()
|
||||
_, _, err := c.ObjectOpen(CONTAINER, OBJECT, true, swift.Headers{
|
||||
"If-None-Match": CONTENT_MD5,
|
||||
})
|
||||
if err != swift.NotModified {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestObjectOpenSeek(t *testing.T) {
|
||||
c, rollback := makeConnectionWithObject(t)
|
||||
defer rollback()
|
||||
|
|
19
vendor/github.com/ncw/swift/swifttest/server.go
generated
vendored
19
vendor/github.com/ncw/swift/swifttest/server.go
generated
vendored
|
@ -44,9 +44,12 @@ const (
|
|||
type HandlerOverrideFunc func(w http.ResponseWriter, r *http.Request, recorder *httptest.ResponseRecorder)
|
||||
|
||||
type SwiftServer struct {
|
||||
// `sync/atomic` expects the first word in an allocated struct to be 64-bit
|
||||
// aligned on both ARM and x86-32.
|
||||
// See https://golang.org/pkg/sync/atomic/#pkg-note-BUG for more details.
|
||||
reqId int64
|
||||
sync.RWMutex
|
||||
t *testing.T
|
||||
reqId int64
|
||||
mu sync.Mutex
|
||||
Listener net.Listener
|
||||
AuthURL string
|
||||
|
@ -121,12 +124,15 @@ type object struct {
|
|||
}
|
||||
|
||||
type container struct {
|
||||
// `sync/atomic` expects the first word in an allocated struct to be 64-bit
|
||||
// aligned on both ARM and x86-32.
|
||||
// See https://golang.org/pkg/sync/atomic/#pkg-note-BUG for more details.
|
||||
bytes int64
|
||||
sync.RWMutex
|
||||
metadata
|
||||
name string
|
||||
ctime time.Time
|
||||
objects map[string]*object
|
||||
bytes int64
|
||||
}
|
||||
|
||||
type segment struct {
|
||||
|
@ -539,8 +545,15 @@ func (objr objectResource) get(a *action) interface{} {
|
|||
reader = bytes.NewReader(obj.data[start : end+1])
|
||||
}
|
||||
|
||||
etagHex := hex.EncodeToString(etag)
|
||||
|
||||
if a.req.Header.Get("If-None-Match") == etagHex {
|
||||
a.w.WriteHeader(http.StatusNotModified)
|
||||
return nil
|
||||
}
|
||||
|
||||
h.Set("Content-Length", fmt.Sprint(end-start+1))
|
||||
h.Set("ETag", hex.EncodeToString(etag))
|
||||
h.Set("ETag", etagHex)
|
||||
h.Set("Last-Modified", obj.mtime.Format(http.TimeFormat))
|
||||
|
||||
if a.req.Method == "HEAD" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue