From e75d412af035ee3c1aa8bffd02368a3afc307995 Mon Sep 17 00:00:00 2001 From: GeneTinderholm Date: Fri, 10 Nov 2017 03:51:12 -0600 Subject: [PATCH 1/2] first section done --- app.js | 14 ++++++++++++++ temp1.js | 14 ++++++++++++++ temp2.js | 14 ++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 app.js create mode 100644 temp1.js create mode 100644 temp2.js diff --git a/app.js b/app.js new file mode 100644 index 0000000..c11d137 --- /dev/null +++ b/app.js @@ -0,0 +1,14 @@ +const http = require('http'); + +const hostname = 'localhost'; +const port = 3000; + +const server = http.createServer(function(req, res){ + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.end('Hello World\n'); +}); + +server.listen(port, hostname, () => { + console.log(`Server running at http://${hostname}:${port}/`); +}); diff --git a/temp1.js b/temp1.js new file mode 100644 index 0000000..b1cc167 --- /dev/null +++ b/temp1.js @@ -0,0 +1,14 @@ +const http = require('http'); + +const hostname = 'localhost'; +const port = 3000; + +const server = http.createServer((req, res) => { + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.end('Hello World\n'); +}); + +server.listen(port, hostname, () => { + console.log(`Server running at http://${hostname}:${port}/`); +}); diff --git a/temp2.js b/temp2.js new file mode 100644 index 0000000..c146202 --- /dev/null +++ b/temp2.js @@ -0,0 +1,14 @@ +const http = require('http'); + +const hostname = '127.0.0.1'; +const port = 3000; + +const server = http.createServer((req, res) => { + res.statusCode = 200; + res.setHeader('Content-Type', 'text/plain'); + res.end('Hello World\n'); +}); + +server.listen(port, hostname, () => { + console.log(`Server running at http://${hostname}:${port}/`); +}); From 86c0a55d1c5e7184a99fef444e50e40cc99a59cd Mon Sep 17 00:00:00 2001 From: GeneTinderholm Date: Fri, 10 Nov 2017 05:54:54 -0600 Subject: [PATCH 2/2] done --- app.js | 27 +- public/index.html | 29 ++ req.txt | 755 +++++++++++++++++++++++++++++ res.txt | 423 ++++++++++++++++ resreq.txt | 1181 +++++++++++++++++++++++++++++++++++++++++++++ temp1.js | 14 - temp2.js | 14 - 7 files changed, 2410 insertions(+), 33 deletions(-) create mode 100644 public/index.html create mode 100644 req.txt create mode 100644 res.txt create mode 100644 resreq.txt delete mode 100644 temp1.js delete mode 100644 temp2.js diff --git a/app.js b/app.js index c11d137..f6b9734 100644 --- a/app.js +++ b/app.js @@ -1,14 +1,31 @@ const http = require('http'); +const fs = require('fs'); const hostname = 'localhost'; const port = 3000; const server = http.createServer(function(req, res){ - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end('Hello World\n'); + fs.readFile('./public/index.html', 'utf8', function(err, data){ + if(err){ + res.writeHead(404); + res.end("404 Page Not Found"); + }else{ + resVar = JSON.stringify({statusMessage: res.statusMessage, + statusCode: res.statusCode, + header: res._header}, null, 2); + reqVar = JSON.stringify({url: req.url, + method: req.method, + httpVersion: req.httpVersion, + headers: req.headers}, null, 2); + let data2 = data.replace(/{{ res }}/, resVar); + let data3 = data2.replace(/{{ req }}/, reqVar); + res.writeHead(200, { + 'Content-Type': 'text/html' + }); + res.end(data3); + } + }); }); - server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); + console.log(`Server running at http://${hostname}:${port}/`); }); diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..c3edd37 --- /dev/null +++ b/public/index.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + +

It worked!

+
+

Request:

+
{{ req }}
+
+

Response:

+
{{ res }}
+
+
+ + + + + +
+ + diff --git a/req.txt b/req.txt new file mode 100644 index 0000000..b3e43e9 --- /dev/null +++ b/req.txt @@ -0,0 +1,755 @@ +{ + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: BufferList { head: null, tail: null, length: 0 }, + length: 0, + pipes: null, + pipesCount: 0, + flowing: null, + ended: true, + endEmitted: false, + reading: false, + sync: true, + needReadable: false, + emittedReadable: true, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: true, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: {}, + _eventsCount: 0, + _maxListeners: undefined, + socket: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Circular], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: + ServerResponse { + domain: null, + _events: [Object], + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: [Circular], + connection: [Circular], + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null }, + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + connection: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Circular], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: + ServerResponse { + domain: null, + _events: [Object], + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: [Circular], + connection: [Circular], + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null }, + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + httpVersionMajor: 1, + httpVersionMinor: 1, + httpVersion: '1.1', + complete: true, + headers: + { host: 'localhost:3000', + connection: 'keep-alive', + 'cache-control': 'max-age=0', + 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', + 'upgrade-insecure-requests': '1', + accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', + 'accept-encoding': 'gzip, deflate, br', + 'accept-language': 'en-US,en;q=0.8' }, + rawHeaders: + [ 'Host', + 'localhost:3000', + 'Connection', + 'keep-alive', + 'Cache-Control', + 'max-age=0', + 'User-Agent', + 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', + 'Upgrade-Insecure-Requests', + '1', + 'Accept', + 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', + 'Accept-Encoding', + 'gzip, deflate, br', + 'Accept-Language', + 'en-US,en;q=0.8' ], + trailers: {}, + rawTrailers: [], + upgrade: false, + url: '/', + method: 'GET', + statusCode: null, + statusMessage: null, + client: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Circular], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: + ServerResponse { + domain: null, + _events: [Object], + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: [Circular], + connection: [Circular], + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null }, + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + _consuming: false, + _dumped: false } diff --git a/res.txt b/res.txt new file mode 100644 index 0000000..eb45fbc --- /dev/null +++ b/res.txt @@ -0,0 +1,423 @@ +{ + domain: null, + _events: { finish: [Function: bound resOnFinish] }, + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Object], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: [Circular], + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + connection: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Object], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: [Circular], + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null } diff --git a/resreq.txt b/resreq.txt new file mode 100644 index 0000000..3ba3328 --- /dev/null +++ b/resreq.txt @@ -0,0 +1,1181 @@ +Server running at http://localhost:3000/ +Res is here: + ServerResponse { + domain: null, + _events: { finish: [Function: bound resOnFinish] }, + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Object], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: [Circular], + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + connection: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Object], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: [Circular], + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null } +Req is here: + IncomingMessage { + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: BufferList { head: null, tail: null, length: 0 }, + length: 0, + pipes: null, + pipesCount: 0, + flowing: null, + ended: true, + endEmitted: false, + reading: false, + sync: true, + needReadable: false, + emittedReadable: true, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: true, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: {}, + _eventsCount: 0, + _maxListeners: undefined, + socket: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Circular], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: + ServerResponse { + domain: null, + _events: [Object], + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: [Circular], + connection: [Circular], + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null }, + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + connection: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Circular], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: + ServerResponse { + domain: null, + _events: [Object], + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: [Circular], + connection: [Circular], + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null }, + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + httpVersionMajor: 1, + httpVersionMinor: 1, + httpVersion: '1.1', + complete: true, + headers: + { host: 'localhost:3000', + connection: 'keep-alive', + 'cache-control': 'max-age=0', + 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', + 'upgrade-insecure-requests': '1', + accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', + 'accept-encoding': 'gzip, deflate, br', + 'accept-language': 'en-US,en;q=0.8' }, + rawHeaders: + [ 'Host', + 'localhost:3000', + 'Connection', + 'keep-alive', + 'Cache-Control', + 'max-age=0', + 'User-Agent', + 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36', + 'Upgrade-Insecure-Requests', + '1', + 'Accept', + 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', + 'Accept-Encoding', + 'gzip, deflate, br', + 'Accept-Language', + 'en-US,en;q=0.8' ], + trailers: {}, + rawTrailers: [], + upgrade: false, + url: '/', + method: 'GET', + statusCode: null, + statusMessage: null, + client: + Socket { + connecting: false, + _hadError: false, + _handle: + TCP { + reading: true, + owner: [Circular], + onread: [Function: onread], + onconnection: null, + writeQueueSize: 0, + _consumed: true }, + _parent: null, + _host: null, + _readableState: + ReadableState { + objectMode: false, + highWaterMark: 16384, + buffer: [Object], + length: 0, + pipes: null, + pipesCount: 0, + flowing: true, + ended: false, + endEmitted: false, + reading: true, + sync: false, + needReadable: true, + emittedReadable: false, + readableListening: false, + resumeScheduled: false, + destroyed: false, + defaultEncoding: 'utf8', + awaitDrain: 0, + readingMore: false, + decoder: null, + encoding: null }, + readable: true, + domain: null, + _events: + { end: [Array], + finish: [Function: onSocketFinish], + _socketEnd: [Function: onSocketEnd], + drain: [Array], + timeout: [Function: socketOnTimeout], + data: [Function: bound socketOnData], + error: [Function: socketOnError], + close: [Array], + resume: [Function: onSocketResume], + pause: [Function: onSocketPause] }, + _eventsCount: 10, + _maxListeners: undefined, + _writableState: + WritableState { + objectMode: false, + highWaterMark: 16384, + finalCalled: false, + needDrain: false, + ending: false, + ended: false, + finished: false, + destroyed: false, + decodeStrings: false, + defaultEncoding: 'utf8', + length: 0, + writing: false, + corked: 0, + sync: false, + bufferProcessing: false, + onwrite: [Function: bound onwrite], + writecb: null, + writelen: 0, + bufferedRequest: null, + lastBufferedRequest: null, + pendingcb: 6, + prefinished: false, + errorEmitted: false, + bufferedRequestCount: 0, + corkedRequestsFree: [Object] }, + writable: true, + allowHalfOpen: true, + _bytesDispatched: 600, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _server: + Server { + domain: null, + _events: [Object], + _eventsCount: 2, + _maxListeners: undefined, + _connections: 2, + _handle: [Object], + _usingSlaves: false, + _slaves: [], + _unref: false, + allowHalfOpen: true, + pauseOnConnect: false, + httpAllowHalfOpen: false, + timeout: 120000, + keepAliveTimeout: 5000, + _pendingResponseData: 0, + maxHeadersCount: null, + _connectionKey: '4:127.0.0.1:3000', + [Symbol(asyncId)]: 6 }, + _idleTimeout: 120000, + _idleNext: + Socket { + connecting: false, + _hadError: false, + _handle: [Object], + _parent: null, + _host: null, + _readableState: [Object], + readable: true, + domain: null, + _events: [Object], + _eventsCount: 10, + _maxListeners: undefined, + _writableState: [Object], + writable: true, + allowHalfOpen: true, + _bytesDispatched: 0, + _sockname: null, + _pendingData: null, + _pendingEncoding: '', + server: [Object], + _server: [Object], + _idleTimeout: 120000, + _idleNext: [Object], + _idlePrev: [Circular], + _idleStart: 1965, + _destroyed: false, + parser: [Object], + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + [Symbol(asyncId)]: 15, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 16, + [Symbol(triggerAsyncId)]: 6 }, + _idlePrev: + TimersList { + _idleNext: [Circular], + _idlePrev: [Object], + _timer: [Object], + _unrefed: true, + msecs: 120000, + nextTick: false }, + _idleStart: 1984, + _destroyed: false, + parser: + HTTPParser { + '0': [Function: parserOnHeaders], + '1': [Function: parserOnHeadersComplete], + '2': [Function: parserOnBody], + '3': [Function: parserOnMessageComplete], + '4': [Function: bound onParserExecute], + _headers: [], + _url: '', + _consumed: true, + socket: [Circular], + incoming: [Circular], + outgoing: null, + maxHeaderPairs: 2000, + onIncoming: [Function: bound parserOnIncoming] }, + on: [Function: socketOnWrap], + _paused: false, + read: [Function], + _consuming: true, + _httpMessage: + ServerResponse { + domain: null, + _events: [Object], + _eventsCount: 1, + _maxListeners: undefined, + output: [], + outputEncodings: [], + outputCallbacks: [], + outputSize: 0, + writable: true, + _last: false, + upgrading: false, + chunkedEncoding: true, + shouldKeepAlive: true, + useChunkedEncodingByDefault: true, + sendDate: true, + _removedConnection: false, + _removedContLen: false, + _removedTE: false, + _contentLength: null, + _hasBody: true, + _trailer: '', + finished: true, + _headerSent: true, + socket: [Circular], + connection: [Circular], + _header: 'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\nDate: Fri, 10 Nov 2017 10:39:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n', + _onPendingData: [Function: bound updateOutgoingData], + _sent100: false, + _expect_continue: false, + statusMessage: 'OK', + statusCode: 200, + [Symbol(outHeadersKey)]: null }, + [Symbol(asyncId)]: 9, + [Symbol(bytesRead)]: 0, + [Symbol(asyncId)]: 11, + [Symbol(triggerAsyncId)]: 6 }, + _consuming: false, + _dumped: false } diff --git a/temp1.js b/temp1.js deleted file mode 100644 index b1cc167..0000000 --- a/temp1.js +++ /dev/null @@ -1,14 +0,0 @@ -const http = require('http'); - -const hostname = 'localhost'; -const port = 3000; - -const server = http.createServer((req, res) => { - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end('Hello World\n'); -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -}); diff --git a/temp2.js b/temp2.js deleted file mode 100644 index c146202..0000000 --- a/temp2.js +++ /dev/null @@ -1,14 +0,0 @@ -const http = require('http'); - -const hostname = '127.0.0.1'; -const port = 3000; - -const server = http.createServer((req, res) => { - res.statusCode = 200; - res.setHeader('Content-Type', 'text/plain'); - res.end('Hello World\n'); -}); - -server.listen(port, hostname, () => { - console.log(`Server running at http://${hostname}:${port}/`); -});