Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.4.0

Bug #18654 Underscores in bucket names
Submitted: 2011-07-06 23:18 UTC
From: jadell Assigned: gauthierm
Status: Closed Package: Services_Amazon_S3 (version 0.3.3)
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2011-07-06 23:18 UTC] jadell (Josh Adell)
Description: ------------ If the bucket has an underscore in the name (ex: my_test_bucket) and using virtual host request style, getting the URL fails with the exception: Invalid bucket name when requestStyle is REQUEST_STYLE_VIRTUAL_HOST: my_test_bucket in /usr/share/php/Services/Amazon/S3.php on line 489 It is possible to browse to the bucket using http://my_test_bucket.s3.amazonaws.com. The regex on line 208 in Bucket.php should be amended to include underscores as valid caharacters.

Comments

 [2011-07-06 23:27 UTC] jadell (Josh Adell)
 [2011-07-06 23:41 UTC] gauthierm (Michael Gauthier)
Thanks for the patch. That's one crazy regexp. I think I will take your patch and rewrite the expression using extended syntax so it can be documented a bit better.
 [2011-07-06 23:56 UTC] gauthierm (Michael Gauthier)
It's worth noting that Amazon's S3 documentation recommends against using underscores in bucket names when using the virtual host access method: "To conform with DNS requirements, we recommend following these additional guidelines when creating buckets: Bucket names should not contain underscores (_) Bucket names should be between 3 and 63 characters long Bucket names should not end with a dash Bucket names cannot contain two, adjacent periods Bucket names cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)"
 [2011-07-07 00:09 UTC] gauthierm (Michael Gauthier)
The caveat here is that some DNS resolvers won't understand underscores. If you know all the software in your stack will work with underscores, they're ok to use. Amazon recommends against it because they don't control all the software people will use to access content on S3. I think in this case it should be up to the developer to choose whether or not to use non-standard DNS names. Ideally we could show some kind of warning, but PEAR does not allow warnings to be raised by packages. I will make the default rules strict (throw an exception on underscore). I will also add an option where you can relax the check and it will not restrict underscores or ending in a dash.
 [2011-07-07 00:49 UTC] gauthierm (Michael Gauthier)
-Status: Open +Status: Closed -Operating System: Linux +Operating System: Irrelevant -PHP Version: 5.3.6 +PHP Version: Irrelevant -Assigned To: +Assigned To: gauthierm
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/ Fixed in r313021. Released in 0.3.4. http://svn.php.net/viewvc?view=revision&revision=313020