validBucketName returns whether name is a valid bucket name. Here are the rules, from: http://docs.amazonwebservices.com/AmazonS3/2006-03-01/dev/BucketRestrictions.html Can contain lowercase letters, numbers, periods (.), underscores (_), and dashes (-). You can use uppercase letters for buckets on
(name string)
| 537 | // but the real S3 server does not seem to check that rule, so we will not |
| 538 | // check it either. |
| 539 | func validBucketName(name string) bool { |
| 540 | if len(name) < 3 || len(name) > 255 { |
| 541 | return false |
| 542 | } |
| 543 | r := name[0] |
| 544 | if r < '0' || (r > '9' && r < 'a') || r > 'z' { |
| 545 | return false |
| 546 | } |
| 547 | for _, r := range name { |
| 548 | switch { |
| 549 | case r >= '0' && r <= '9': |
| 550 | case r >= 'a' && r <= 'z': |
| 551 | case r == '_' || r == '-': |
| 552 | case r == '.': |
| 553 | default: |
| 554 | return false |
| 555 | } |
| 556 | } |
| 557 | return true |
| 558 | } |
| 559 | |
| 560 | var responseParams = map[string]bool{ |
| 561 | "content-type": true, |