|
@ -23,18 +23,6 @@ exports.parse = function(options) { |
|
|
return promise; |
|
|
return promise; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// Temporarly until http.ServerRequest.headers are case-insensitive
|
|
|
|
|
|
function getHeader(name, headers) { |
|
|
|
|
|
var val; |
|
|
|
|
|
for (var header in headers) { |
|
|
|
|
|
if (header.toLowerCase() === name.toLowerCase()) { |
|
|
|
|
|
val = headers[header]; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return val; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
exports.Stream = function(options) { |
|
|
exports.Stream = function(options) { |
|
|
node.EventEmitter.call(this); |
|
|
node.EventEmitter.call(this); |
|
|
|
|
|
|
|
@ -52,13 +40,13 @@ proto.init = function(options) { |
|
|
this.part = null; |
|
|
this.part = null; |
|
|
|
|
|
|
|
|
if ('headers' in options) { |
|
|
if ('headers' in options) { |
|
|
var req = options, contentType = getHeader('content-type', req.headers); |
|
|
var req = options, contentType = req.headers['content-type']; |
|
|
if (contentType) { |
|
|
if (contentType) { |
|
|
contentType = contentType.split(/; ?boundary=/) |
|
|
contentType = contentType.split(/; ?boundary=/) |
|
|
this.boundary = '--'+contentType[1]; |
|
|
this.boundary = '--'+contentType[1]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.bytesTotal = getHeader('content-length', req.headers); |
|
|
this.bytesTotal = req.headers['content-length']; |
|
|
|
|
|
|
|
|
var self = this; |
|
|
var self = this; |
|
|
req |
|
|
req |
|
|