Skip to content

Commit

Permalink
Made it so that if we pass in Content-Length or content-length in the…
Browse files Browse the repository at this point in the history
… headers, don't make a new version
  • Loading branch information
danjenkins committed Nov 5, 2012
1 parent 9a3129c commit 61e3850
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.js
Expand Up @@ -290,6 +290,7 @@ Request.prototype.init = function (options) {
length = self.body.length
}
if (length) {
if(!self.headers['content-length'] && !self.headers['Content-Length'])
self.headers['content-length'] = length
} else {
throw new Error('Argument error, options.body.')
Expand Down Expand Up @@ -509,13 +510,12 @@ Request.prototype.start = function () {
self.href = self.uri.href
if (log) log('%method %href', self)

if (self.src && self.src.stat && self.src.stat.size) {
if (self.src && self.src.stat && self.src.stat.size && !self.headers['content-length'] && !self.headers['Content-Length']) {
self.headers['content-length'] = self.src.stat.size
}
if (self._aws) {
self.aws(self._aws, true)
}

self.req = self.httpModule.request(self, function (response) {
if (response.connection.listeners('error').indexOf(self._parserErrorHandler) === -1) {
response.connection.once('error', self._parserErrorHandler)
Expand Down

0 comments on commit 61e3850

Please sign in to comment.