Path: blob/main/third_party/closure-compiler/node-externs/http.js
6171 views
/*1* Copyright 2012 The Closure Compiler Authors.2*3* Licensed under the Apache License, Version 2.0 (the "License");4* you may not use this file except in compliance with the License.5* You may obtain a copy of the License at6*7* http://www.apache.org/licenses/LICENSE-2.08*9* Unless required by applicable law or agreed to in writing, software10* distributed under the License is distributed on an "AS IS" BASIS,11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12* See the License for the specific language governing permissions and13* limitations under the License.14*/1516/**17* @fileoverview Definitions for node's http module. Depends on the events module.18* @see http://nodejs.org/api/http.html19* @see https://github.com/joyent/node/blob/master/lib/http.js20* @externs21*/2223/**24BEGIN_NODE_INCLUDE25var http = require('http');26END_NODE_INCLUDE27*/2829var http = {};3031/**32* @typedef {function(http.IncomingMessage, http.ServerResponse)}33*/34http.requestListener;3536/**37* @param {http.requestListener=} listener38* @return {http.Server}39*/40http.createServer = function(listener) {};4142/**43* @param {http.requestListener=} listener44* @constructor45* @extends events.EventEmitter46*/47http.Server = function(listener) {};4849/**50* @param {(number|string)} portOrPath51* @param {(string|Function)=} hostnameOrCallback52* @param {Function=} callback53*/54http.Server.prototype.listen = function(portOrPath, hostnameOrCallback, callback) {};5556/**57*/58http.Server.prototype.close = function() {};5960/**61* @constructor62* @extends stream.Readable63*/64http.IncomingMessage = function() {};6566/**67* @type {?string}68* */69http.IncomingMessage.prototype.method;7071/**72* @type {?string}73*/74http.IncomingMessage.prototype.url;7576/**77* @type {Object}78* */79http.IncomingMessage.prototype.headers;8081/**82* @type {Object}83* */84http.IncomingMessage.prototype.trailers;8586/**87* @type {string}88*/89http.IncomingMessage.prototype.httpVersion;9091/**92* @type {string}93*/94http.IncomingMessage.prototype.httpVersionMajor;9596/**97* @type {string}98*/99http.IncomingMessage.prototype.httpVersionMinor;100101/**102* @type {*}103*/104http.IncomingMessage.prototype.connection;105106/**107* @type {?number}108*/109http.IncomingMessage.prototype.statusCode;110111/**112* @type {net.Socket}113*/114http.IncomingMessage.prototype.socket;115116/**117* @param {number} msecs118* @param {function()} callback119*/120http.IncomingMessage.prototype.setTimeout = function(msecs, callback) {};121122/**123* @constructor124* @extends events.EventEmitter125* @private126*/127http.ServerResponse = function() {};128129/**130*/131http.ServerResponse.prototype.writeContinue = function() {};132133/**134* @param {number} statusCode135* @param {*=} reasonPhrase136* @param {*=} headers137*/138http.ServerResponse.prototype.writeHead = function(statusCode, reasonPhrase, headers) {};139140/**141* @type {number}142*/143http.ServerResponse.prototype.statusCode;144145/**146* @param {string} name147* @param {string} value148*/149http.ServerResponse.prototype.setHeader = function(name, value) {};150151/**152* @param {string} name153* @return {string|undefined} value154*/155http.ServerResponse.prototype.getHeader = function(name) {};156157/**158* @param {string} name159*/160http.ServerResponse.prototype.removeHeader = function(name) {};161162/**163* @param {string|Array|nodeBuffer.Buffer} chunk164* @param {string=} encoding165*/166http.ServerResponse.prototype.write = function(chunk, encoding) {};167168/**169* @param {Object} headers170*/171http.ServerResponse.prototype.addTrailers = function(headers) {};172173/**174* @param {(string|Array|nodeBuffer.Buffer)=} data175* @param {string=} encoding176*/177http.ServerResponse.prototype.end = function(data, encoding) {};178179/**180* @constructor181* @extends events.EventEmitter182* @private183*/184http.ClientRequest = function() {};185186/**187* @param {string|Array|nodeBuffer.Buffer} chunk188* @param {string=} encoding189*/190http.ClientRequest.prototype.write = function(chunk, encoding) {};191192/**193* @param {(string|Array|nodeBuffer.Buffer)=} data194* @param {string=} encoding195*/196http.ClientRequest.prototype.end = function(data, encoding) {};197198/**199*/200http.ClientRequest.prototype.abort = function() {};201202/**203* @param {Object} options204* @param {function(http.IncomingMessage)} callback205* @return {http.ClientRequest}206*/207http.request = function(options, callback) {};208209/**210* @param {Object} options211* @param {function(http.IncomingMessage)} callback212* @return {http.ClientRequest}213*/214http.get = function(options, callback) {};215216/**217* @constructor218* @extends events.EventEmitter219*/220http.Agent = function() {};221222/**223* @type {number}224*/225http.Agent.prototype.maxSockets;226227/**228* @type {number}229*/230http.Agent.prototype.sockets;231232/**233* @type {Array.<http.ClientRequest>}234*/235http.Agent.prototype.requests;236237/**238* @type {http.Agent}239*/240http.globalAgent;241242243