Skip to content

Commit 9f0de9e

Browse files
committed
Tweak
1 parent d26af0d commit 9f0de9e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

proxy.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ var https=require('https');
1212
var EventEmitter=require('events').EventEmitter;
1313

1414
var request = function(opts, callback){
15+
16+
/*
17+
// Use fiddler?
18+
opts.path = (opts.protocol === 'https:'? "https" : "http" ) + '://' + opts.host + (opts.port?':' + opts.port:'') + opts.path;
19+
if(!opts.headers){
20+
opts.headers = {};
21+
}
22+
opts.headers.host = opts.host;
23+
opts.host = '127.0.0.1';
24+
// opts.host = 'localhost';
25+
opts.port = 8888;
26+
// opts.protocol = null;
27+
28+
/**/
29+
1530
var req = (opts.protocol === 'https:'? https : http ).request(opts, callback);
1631
return req;
1732
};
@@ -236,7 +251,8 @@ exports.proxy = function(req, res, options, buffer){
236251
return;
237252
}
238253

239-
var flushed = _req.write(chunk, encoding);
254+
// Writing chunk data doesn not require an encoding parameter
255+
var flushed = _req.write(chunk);
240256

241257
if (flushed){
242258
return;
@@ -315,7 +331,7 @@ exports.buffer = function (obj) {
315331
},
316332
resume: function () {
317333
this.end();
318-
for (var i = 0, len = events.length; i < len; ++i) {
334+
for (var i = 0, len = events.length; i < len; i++) {
319335
obj.emit.apply(obj, events[i]);
320336
}
321337
}

0 commit comments

Comments
 (0)