[s3-dev] AWS::S3::SignatureDoesNotMatch error when content-type can't be inferred
Stephen Caudill
scaudill at gmail.com
Fri Dec 15 11:15:48 EST 2006
On Dec 14, 2006, at 5:59 PM, Marcel Molina Jr. wrote:
> Hey Stephen, thanks for reporting this.
>
> Someone brought this up a few weeks ago (http://
> developer.amazonwebservices.com/connect/message.jspa?
> messageID=49153#49156) and at the time I couldn't recreate
> it. I still can't recreate it actually, which is weird:
>
>>> S3Object.store('s3sh', File.open('/opt/local/bin/s3sh'), 'marcel')
> => #<AWS::S3::S3Object::Response:0x10993930 200 OK>
Hmm... that is weird. I wonder if it's an environment thing?
I'm on a MacBook Pro. Here's my Ruby version, straight from the
horses mouth:
[10:38:37][caudill at lazuli][caudill]$ ruby -v
ruby 1.8.5 (2006-08-25) [i686-darwin8.8.1]
I noted that you have a test that specifically checks to ensure that
you can store a file with no extension and no content-type
specified... which passes on my computer, only further adding to my
befuddlement.
Hmmm... I think I've got a box that's running ruby 1.8.4, let me give
that a whirl.
Okay, so on a Fedora Core 1 box:
[10:54:32][root at toohot][~]$ ruby -v
ruby 1.8.4 (2005-12-24) [i686-linux]
[11:01:03][root at toohot][lib]$ irb
irb(main):001:0> require 'aws/s3'
=> true
irb(main):002:0> include AWS::S3
=> Object
irb(main):003:0> Base.establish_connection!(
irb(main):004:1* :access_key_id => 'foo',
irb(main):005:1* :secret_access_key => 'bar'
irb(main):006:1> )
=> #<AWS::S3::Connection:0x40bd4908 @http=#<Net::HTTP
s3.amazonaws.com:80 open=false>, @secret_access_key="bar", @options=
{:secret_access_key=>"bar", :port=>80, :server=>"s3.amazonaws.com", :acc
ess_key_id=>"foo"}, @access_key_id="foo">
irb(main):007:0> Bucket.create('buckets-r-teh-niftyest')
=> true
irb(main):010:0> S3Object.store('s3sh', File.open('/usr/local/bin/
s3sh'), 'buckets-r-teh-niftyest')
=> #<AWS::S3::S3Object::Response:0x543017732 200 OK>
Works like a charm. So, from my end, it looks like a difference
between ruby 1.8.4 and ruby 1.8.5. Also, given that the test that
checks for nil content-type being properly inferred (in trunk it's:
test/object_test.rb:47) is passing when the functionality fails,
there's probably a bug there too.
> Since I can't reproduce the problem, I don't know if that fixes it
> though it
> seems to have worked for him. Unfortunately that breaks other
> behavior. It
> makes it so you can't explicitly set a content type on an instance
> of an
> S3Object. The fix so that both live happily ever after probably
> isn't that
> tough. I plan on looking into the specifics and working up a fix soon.
I've got some extra time this afternoon, so I'll take a look into it
too. I've got a lot more to go on now than I did before, so maybe
I'll have some luck with it.
> Thanks again for the report and sorry for the lag time in
> responding (I was
> withouth internet yesterday),
> marcel
No worries :) thanks a bunch for the lib. It's significantly more
elegant and complete than what I'd cobbled together :) I'm currently
using AWS::S3 on a development server on EC2 right now, to manage our
automated backups since there's no such thing as persistent storage.
Always an adventure...
Cheers!
- Stephen
More information about the amazon-s3-dev
mailing list