Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/third_party/closure-compiler/node-externs/http.js
6171 views
1
/*
2
* Copyright 2012 The Closure Compiler Authors.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
/**
18
* @fileoverview Definitions for node's http module. Depends on the events module.
19
* @see http://nodejs.org/api/http.html
20
* @see https://github.com/joyent/node/blob/master/lib/http.js
21
* @externs
22
*/
23
24
/**
25
BEGIN_NODE_INCLUDE
26
var http = require('http');
27
END_NODE_INCLUDE
28
*/
29
30
var http = {};
31
32
/**
33
* @typedef {function(http.IncomingMessage, http.ServerResponse)}
34
*/
35
http.requestListener;
36
37
/**
38
* @param {http.requestListener=} listener
39
* @return {http.Server}
40
*/
41
http.createServer = function(listener) {};
42
43
/**
44
* @param {http.requestListener=} listener
45
* @constructor
46
* @extends events.EventEmitter
47
*/
48
http.Server = function(listener) {};
49
50
/**
51
* @param {(number|string)} portOrPath
52
* @param {(string|Function)=} hostnameOrCallback
53
* @param {Function=} callback
54
*/
55
http.Server.prototype.listen = function(portOrPath, hostnameOrCallback, callback) {};
56
57
/**
58
*/
59
http.Server.prototype.close = function() {};
60
61
/**
62
* @constructor
63
* @extends stream.Readable
64
*/
65
http.IncomingMessage = function() {};
66
67
/**
68
* @type {?string}
69
* */
70
http.IncomingMessage.prototype.method;
71
72
/**
73
* @type {?string}
74
*/
75
http.IncomingMessage.prototype.url;
76
77
/**
78
* @type {Object}
79
* */
80
http.IncomingMessage.prototype.headers;
81
82
/**
83
* @type {Object}
84
* */
85
http.IncomingMessage.prototype.trailers;
86
87
/**
88
* @type {string}
89
*/
90
http.IncomingMessage.prototype.httpVersion;
91
92
/**
93
* @type {string}
94
*/
95
http.IncomingMessage.prototype.httpVersionMajor;
96
97
/**
98
* @type {string}
99
*/
100
http.IncomingMessage.prototype.httpVersionMinor;
101
102
/**
103
* @type {*}
104
*/
105
http.IncomingMessage.prototype.connection;
106
107
/**
108
* @type {?number}
109
*/
110
http.IncomingMessage.prototype.statusCode;
111
112
/**
113
* @type {net.Socket}
114
*/
115
http.IncomingMessage.prototype.socket;
116
117
/**
118
* @param {number} msecs
119
* @param {function()} callback
120
*/
121
http.IncomingMessage.prototype.setTimeout = function(msecs, callback) {};
122
123
/**
124
* @constructor
125
* @extends events.EventEmitter
126
* @private
127
*/
128
http.ServerResponse = function() {};
129
130
/**
131
*/
132
http.ServerResponse.prototype.writeContinue = function() {};
133
134
/**
135
* @param {number} statusCode
136
* @param {*=} reasonPhrase
137
* @param {*=} headers
138
*/
139
http.ServerResponse.prototype.writeHead = function(statusCode, reasonPhrase, headers) {};
140
141
/**
142
* @type {number}
143
*/
144
http.ServerResponse.prototype.statusCode;
145
146
/**
147
* @param {string} name
148
* @param {string} value
149
*/
150
http.ServerResponse.prototype.setHeader = function(name, value) {};
151
152
/**
153
* @param {string} name
154
* @return {string|undefined} value
155
*/
156
http.ServerResponse.prototype.getHeader = function(name) {};
157
158
/**
159
* @param {string} name
160
*/
161
http.ServerResponse.prototype.removeHeader = function(name) {};
162
163
/**
164
* @param {string|Array|nodeBuffer.Buffer} chunk
165
* @param {string=} encoding
166
*/
167
http.ServerResponse.prototype.write = function(chunk, encoding) {};
168
169
/**
170
* @param {Object} headers
171
*/
172
http.ServerResponse.prototype.addTrailers = function(headers) {};
173
174
/**
175
* @param {(string|Array|nodeBuffer.Buffer)=} data
176
* @param {string=} encoding
177
*/
178
http.ServerResponse.prototype.end = function(data, encoding) {};
179
180
/**
181
* @constructor
182
* @extends events.EventEmitter
183
* @private
184
*/
185
http.ClientRequest = function() {};
186
187
/**
188
* @param {string|Array|nodeBuffer.Buffer} chunk
189
* @param {string=} encoding
190
*/
191
http.ClientRequest.prototype.write = function(chunk, encoding) {};
192
193
/**
194
* @param {(string|Array|nodeBuffer.Buffer)=} data
195
* @param {string=} encoding
196
*/
197
http.ClientRequest.prototype.end = function(data, encoding) {};
198
199
/**
200
*/
201
http.ClientRequest.prototype.abort = function() {};
202
203
/**
204
* @param {Object} options
205
* @param {function(http.IncomingMessage)} callback
206
* @return {http.ClientRequest}
207
*/
208
http.request = function(options, callback) {};
209
210
/**
211
* @param {Object} options
212
* @param {function(http.IncomingMessage)} callback
213
* @return {http.ClientRequest}
214
*/
215
http.get = function(options, callback) {};
216
217
/**
218
* @constructor
219
* @extends events.EventEmitter
220
*/
221
http.Agent = function() {};
222
223
/**
224
* @type {number}
225
*/
226
http.Agent.prototype.maxSockets;
227
228
/**
229
* @type {number}
230
*/
231
http.Agent.prototype.sockets;
232
233
/**
234
* @type {Array.<http.ClientRequest>}
235
*/
236
http.Agent.prototype.requests;
237
238
/**
239
* @type {http.Agent}
240
*/
241
http.globalAgent;
242
243