Permalink
Browse files

Add support for Content-MD5 header.

  • Loading branch information...
mtyaka committed Dec 9, 2011
1 parent f9b5c38 commit 498ce17f03027e7de112ddc6c1abdf8eccc2a434
Showing with 4 additions and 1 deletion.
  1. +1 −0 nox.js
  2. +3 −1 test-noxmox.js
View
1 nox.js
@@ -56,6 +56,7 @@ exports.createClient = function(options) {
date:date,
resource:auth.canonicalizeResource(path.join('/', options.bucket, filename)),
contentType:headers['Content-Type'],
+ md5:headers['Content-MD5'],
amazonHeaders:auth.canonicalizeHeaders(headers)
});
View
@@ -8,6 +8,7 @@
// The JSON file shall contain an object with the aws key, secret and bucketname.
var fs = require('fs');
+var crypto = require('crypto');
var util = require('util');
var nox = require('./nox.js');
@@ -59,7 +60,8 @@ function upload(client, name, buf, callback) {
console.log('\nFile upload');
var req = client.put(name, {
'Content-Type':'text/plain',
- 'Content-Length':buf.length
+ 'Content-Length':buf.length,
+ 'Content-MD5': crypto.createHash('md5').update(buf).digest('base64')
});
req.on('error', function(err) {
console.log(err.message || err);

0 comments on commit 498ce17

Please sign in to comment.