mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Expose full callback names
This commit is contained in:
parent
d48f67eb90
commit
220f5fb795
@ -28,7 +28,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
deleteLength : function(req, res, options) {
|
||||
deleteLength : function deleteLength(req, res, options) {
|
||||
if((req.method === 'DELETE' || req.method === 'OPTIONS')
|
||||
&& !req.headers['content-length']) {
|
||||
req.headers['content-length'] = '0';
|
||||
@ -46,7 +46,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
timeout: function(req, res, options) {
|
||||
timeout: function timeout(req, res, options) {
|
||||
if(options.timeout) {
|
||||
req.socket.setTimeout(options.timeout);
|
||||
}
|
||||
@ -62,7 +62,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHeaders : function(req, res, options) {
|
||||
XHeaders : function XHeaders(req, res, options) {
|
||||
if(!options.xfwd) return;
|
||||
|
||||
var encrypted = req.isSpdy || common.hasEncryptedConnection(req);
|
||||
@ -94,7 +94,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
stream : function(req, res, options, _, server, clb) {
|
||||
stream : function stream(req, res, options, _, server, clb) {
|
||||
|
||||
// And we begin!
|
||||
server.emit('start', req, res, options.target)
|
||||
|
||||
@ -23,7 +23,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
removeChunked : function (req, res, proxyRes) {
|
||||
removeChunked : function removeChunked(req, res, proxyRes) {
|
||||
if (req.httpVersion === '1.0') {
|
||||
delete proxyRes.headers['transfer-encoding'];
|
||||
}
|
||||
@ -39,7 +39,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
setConnection: function(req, res, proxyRes) {
|
||||
setConnection: function setConnection(req, res, proxyRes) {
|
||||
if (req.httpVersion === '1.0') {
|
||||
proxyRes.headers.connection = req.headers.connection || 'close';
|
||||
} else if (req.httpVersion !== '2.0' && !proxyRes.headers.connection) {
|
||||
@ -47,7 +47,7 @@ module.exports = { // <--
|
||||
}
|
||||
},
|
||||
|
||||
setRedirectHostRewrite: function(req, res, proxyRes, options) {
|
||||
setRedirectHostRewrite: function setRedirectHostRewrite(req, res, proxyRes, options) {
|
||||
if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite)
|
||||
&& proxyRes.headers['location']
|
||||
&& redirectRegex.test(proxyRes.statusCode)) {
|
||||
@ -82,7 +82,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
writeHeaders : function(req, res, proxyRes, options) {
|
||||
writeHeaders : function writeHeaders(req, res, proxyRes, options) {
|
||||
var rewriteCookieDomainConfig = options.cookieDomainRewrite;
|
||||
if (typeof rewriteCookieDomainConfig === 'string') { //also test for ''
|
||||
rewriteCookieDomainConfig = { '*': rewriteCookieDomainConfig };
|
||||
@ -107,7 +107,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
writeStatusCode : function(req, res, proxyRes) {
|
||||
writeStatusCode : function writeStatusCode(req, res, proxyRes) {
|
||||
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
|
||||
if(proxyRes.statusMessage) {
|
||||
res.writeHead(proxyRes.statusCode, proxyRes.statusMessage);
|
||||
|
||||
@ -27,7 +27,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
checkMethodAndHeader : function (req, socket) {
|
||||
checkMethodAndHeader : function checkMethodAndHeader(req, socket) {
|
||||
if (req.method !== 'GET' || !req.headers.upgrade) {
|
||||
socket.destroy();
|
||||
return true;
|
||||
@ -49,7 +49,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHeaders : function(req, socket, options) {
|
||||
XHeaders : function XHeaders(req, socket, options) {
|
||||
if(!options.xfwd) return;
|
||||
|
||||
var values = {
|
||||
@ -76,7 +76,7 @@ module.exports = {
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
stream : function(req, socket, options, head, server, clb) {
|
||||
stream : function stream(req, socket, options, head, server, clb) {
|
||||
common.setupSocket(socket);
|
||||
|
||||
if (head && head.length) socket.unshift(head);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user