Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit 787ef3d

Browse files
committed
Replace ServerRequest/ClientResponse with IncomingMessage
Replace the http.ServerRequest and http.ClientResponse classes with the IncomingMessage class, as is done in recent versions of node. Add the missing members to the prototype. Signed-off-by: Kevin Locke <[email protected]>
1 parent fdf9cfd commit 787ef3d

File tree

3 files changed

+27
-75
lines changed

3 files changed

+27
-75
lines changed

contrib/Ws.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ws.Server = function(options, callback) {};
4848
ws.Server.prototype.close = function(code, data) {};
4949

5050
/**
51-
* @param {http.ServerRequest} request
51+
* @param {http.IncomingMessage} request
5252
* @param {net.Socket} socket
5353
* @param {string} upgradeHead
5454
* @param {function(...)} callback

http.js

Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ END_NODE_INCLUDE
3030
var http = {};
3131

3232
/**
33-
* @typedef {function(http.ServerRequest, http.ServerResponse)}
33+
* @typedef {function(http.IncomingMessage, http.ServerResponse)}
3434
*/
3535
http.requestListener;
3636

@@ -60,63 +60,65 @@ http.Server.prototype.close = function() {};
6060

6161
/**
6262
* @constructor
63-
* @extends events.EventEmitter
64-
* @private
63+
* @extends stream.Readable
6564
*/
66-
http.ServerRequest = function() {};
65+
http.IncomingMessage = function() {};
6766

6867
/**
69-
* @type {string}
68+
* @type {?string}
7069
* */
71-
http.ServerRequest.prototype.method;
70+
http.IncomingMessage.prototype.method;
7271

7372
/**
74-
* @type {string}
73+
* @type {?string}
7574
*/
76-
http.ServerRequest.prototype.url;
75+
http.IncomingMessage.prototype.url;
7776

7877
/**
7978
* @type {Object}
8079
* */
81-
http.ServerRequest.prototype.headers;
80+
http.IncomingMessage.prototype.headers;
8281

8382
/**
8483
* @type {Object}
8584
* */
86-
http.ServerRequest.prototype.trailers;
85+
http.IncomingMessage.prototype.trailers;
8786

8887
/**
8988
* @type {string}
9089
*/
91-
http.ServerRequest.prototype.httpVersion;
90+
http.IncomingMessage.prototype.httpVersion;
9291

9392
/**
9493
* @type {string}
9594
*/
96-
http.ServerRequest.prototype.httpVersionMajor;
95+
http.IncomingMessage.prototype.httpVersionMajor;
9796

9897
/**
9998
* @type {string}
10099
*/
101-
http.ServerRequest.prototype.httpVersionMinor;
100+
http.IncomingMessage.prototype.httpVersionMinor;
102101

103102
/**
104-
* @param {?string} encoding
103+
* @type {*}
105104
*/
106-
http.ServerRequest.prototype.setEncoding = function(encoding) {};
105+
http.IncomingMessage.prototype.connection;
107106

108107
/**
108+
* @type {?number}
109109
*/
110-
http.ServerRequest.prototype.pause = function() {};
110+
http.IncomingMessage.prototype.statusCode;
111111

112112
/**
113+
* @type {net.Socket}
113114
*/
114-
http.ServerRequest.prototype.resume = function() {};
115+
http.IncomingMessage.prototype.socket;
115116

116117
/**
117-
* @type {*}
118+
* @param {number} msecs
119+
* @param {function()} callback
118120
*/
119-
http.ServerRequest.prototype.connection;
121+
http.IncomingMessage.prototype.setTimeout = function(msecs, callback) {};
120122

121123
/**
122124
* @constructor
@@ -198,66 +200,16 @@ http.ClientRequest.prototype.end = function(data, encoding) {};
198200
*/
199201
http.ClientRequest.prototype.abort = function() {};
200202

201-
/**
202-
* @constructor
203-
* @extends events.EventEmitter
204-
* @private
205-
*/
206-
http.ClientResponse = function() {};
207-
208-
/**
209-
* @type {number}
210-
*/
211-
http.ClientResponse.prototype.statusCode;
212-
213-
/**
214-
* @type {string}
215-
*/
216-
http.ClientResponse.prototype.httpVersion;
217-
218-
/**
219-
* @type {string}
220-
*/
221-
http.ClientResponse.prototype.httpVersionMajor;
222-
223-
/**
224-
* @type {string}
225-
*/
226-
http.ClientResponse.prototype.httpVersionMinor;
227-
228-
/**
229-
* @type {Object}
230-
* */
231-
http.ClientResponse.prototype.headers;
232-
233-
/**
234-
* @type {Object}
235-
* */
236-
http.ClientResponse.prototype.trailers;
237-
238-
/**
239-
* @param {?string} encoding
240-
*/
241-
http.ClientResponse.prototype.setEncoding = function(encoding) {};
242-
243-
/**
244-
*/
245-
http.ClientResponse.prototype.pause = function() {};
246-
247-
/**
248-
*/
249-
http.ClientResponse.prototype.resume = function() {};
250-
251203
/**
252204
* @param {Object} options
253-
* @param {function(http.ClientResponse)} callback
205+
* @param {function(http.IncomingMessage)} callback
254206
* @return {http.ClientRequest}
255207
*/
256208
http.request = function(options, callback) {};
257209

258210
/**
259211
* @param {Object} options
260-
* @param {function(http.ClientResponse)} callback
212+
* @param {function(http.IncomingMessage)} callback
261213
* @return {http.ClientRequest}
262214
*/
263215
http.get = function(options, callback) {};

https.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ https.Server.prototype.close = function(callback) {};
4747

4848
/**
4949
* @param {tls.CreateOptions} options
50-
* @param {function(https.Request, https.Response)=} requestListener
50+
* @param {function(http.IncomingMessage, http.ServerResponse)=} requestListener
5151
*/
5252
https.createServer = function(options, requestListener) {};
5353

@@ -58,14 +58,14 @@ https.ConnectOptions;
5858

5959
/**
6060
* @param {https.ConnectOptions|string} options
61-
* @param {function(http.ClientResponse)} callback
61+
* @param {function(http.IncomingMessage)} callback
6262
* @return {http.ClientRequest}
6363
*/
6464
https.request = function(options, callback) {};
6565

6666
/**
6767
* @param {https.ConnectOptions|string} options
68-
* @param {function(http.ClientResponse)} callback
68+
* @param {function(http.IncomingMessage)} callback
6969
* @return {http.ClientRequest}
7070
*/
7171
https.get = function(options, callback) {};

0 commit comments

Comments
 (0)