Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* by Vincent Hellot .
*
* @author Luis Merino
*/
var Multipart = exports.Multipart = function(boundary, useBuffers) {
EventEmitter.call(this);
this.boundaryLength = 0;
this.randomBoundaryPartLength = 32;
this.boundary = boundary || this.getBoundary();
this.crlf = '\r\n';
this.useBuffers = useBuffers;
};
Sys.inherits(Multipart, EventEmitter);
(function() {
// algorithm borrowed from curl Curl_FormBoundary
this.getBoundary = function() {
var allowedChars = '0123456789abcdef';
var boundary = '';
var i = 0;
var len = this.boundaryLength - this.randomBoundaryPartLength;
for (i = 0; i < len; i++)
boundary += '-';
for (i = 0; i < this.randomBoundaryPartLength; i++)
boundary += allowedChars[Math.floor(Math.random() * 15 + 1)];
this.maxFieldsSize = 2 * 1024 * 1024;
this.keepExtensions = false;
this.uploadDir = '/tmp';
this.encoding = 'utf-8';
this.headers = null;
this.type = null;
this.bytesReceived = null;
this.bytesExpected = null;
this._parser = null;
this._flushing = 0;
this._fieldsSize = 0;
};
sys.inherits(IncomingForm, EventEmitter);
exports.IncomingForm = IncomingForm;
IncomingForm.prototype.parse = function(req, cb) {
this.pause = function() {
try {
req.pause();
} catch (err) {
// the stream was destroyed
if (!this.ended) {
// before it was completed, crash & burn
this._error(err);
}
return false;
}
return true;
};
var Model = require('model');
var TestSuperModel = module.exports = function( params ) {
this._init( params );
};
require('sys').inherits( TestSuperModel, Model );
var models = {};
TestSuperModel.model = function( clazz, app ) {
var existed_inst = models[ clazz.get_some_importentd_value() ];
return existed_inst || ( models[ clazz.get_some_importentd_value() ] = new clazz({
app : app
}) );
}
var Processor = function(proc) {
this.processor = function() {
this.methods = new proc(this);
EE.call(this.methods);
}
sys.inherits(this.processor, EE);
}
function createBrowser (name, proto) {
Browsers[name] = function () {
Browser.apply(this);
};
sys.inherits(Browsers[name], Browser);
for (
var k in proto
) Browsers[name].prototype[k] = proto[k];
}