From b60df56157ee1fd0bd4938799bac05a62fda91a1 Mon Sep 17 00:00:00 2001 From: lookshe Date: Sat, 14 Mar 2015 20:45:20 +0100 Subject: initial commit from working version --- .../socket.io/lib/transports/htmlfile.js | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 signaling-server/node_modules/socket.io/lib/transports/htmlfile.js (limited to 'signaling-server/node_modules/socket.io/lib/transports/htmlfile.js') diff --git a/signaling-server/node_modules/socket.io/lib/transports/htmlfile.js b/signaling-server/node_modules/socket.io/lib/transports/htmlfile.js new file mode 100644 index 0000000..fce0c0e --- /dev/null +++ b/signaling-server/node_modules/socket.io/lib/transports/htmlfile.js @@ -0,0 +1,83 @@ + +/*! + * socket.io-node + * Copyright(c) 2011 LearnBoost + * MIT Licensed + */ + +/** + * Module requirements. + */ + +var HTTPTransport = require('./http'); + +/** + * Export the constructor. + */ + +exports = module.exports = HTMLFile; + +/** + * HTMLFile transport constructor. + * + * @api public + */ + +function HTMLFile (mng, data, req) { + HTTPTransport.call(this, mng, data, req); +}; + +/** + * Inherits from Transport. + */ + +HTMLFile.prototype.__proto__ = HTTPTransport.prototype; + +/** + * Transport name + * + * @api public + */ + +HTMLFile.prototype.name = 'htmlfile'; + +/** + * Handles the request. + * + * @api private + */ + +HTMLFile.prototype.handleRequest = function (req) { + HTTPTransport.prototype.handleRequest.call(this, req); + + if (req.method == 'GET') { + req.res.writeHead(200, { + 'Content-Type': 'text/html; charset=UTF-8' + , 'Connection': 'keep-alive' + , 'Transfer-Encoding': 'chunked' + }); + + req.res.write( + '' + + '' + + new Array(174).join(' ') + ); + } +}; + +/** + * Performs the write. + * + * @api private + */ + +HTMLFile.prototype.write = function (data) { + // escape all forward slashes. see GH-1251 + data = ''; + + if (this.response.write(data)) { + this.drained = true; + } + + this.log.debug(this.name + ' writing', data); +}; -- cgit v1.2.3