LearnBoost/knox — Issue #43: 501 Transfer-Encoding not implemented on a PUT.  Wtf?
Author: nickretallack
Created: 2011-10-30 03:10:43+00:00
State: open

I'm trying to use knox to put some data on S3 but it always fails with a 501. Here's my code. Ignore the extra returns -- it's generated from coffee-script.

```
knox = require('knox');
s3 = knox.createClient({####SECRET####})
test_s3 = function() {
var buffer, request;
buffer = new Buffer(6);
buffer.write("Hello");
request = s3.put('test-key');
return request.on('response', function(response) {
console.log(response.statusCode);
return response.on('data', function(data) {
return console.log(data.toString('ascii'));
});
});
};
test_s3();
```
What I get on the console is this:
```
501

NotImplementedA header you provided implies functionality that is not implemented

Transfer-Encoding

67F400ED6D76C07AoyEU9C4gk/Kf6PQta2roQ2q0Pe1cfvi1BeoVUhsEPNV5qf/39ZmOVXCn5HqdCZtq
```

This doesn't make sense to me. Googling around, I found that S3 usually returns this response when you try and do some operation that shouldn't send any content, but you sent content anyway. But this is a put. It's supposed to have content. Looking through the request object, it appears that content length is set and the body is being written as it should be. So what is going wrong?