avwo / whistle

@@ -2307,6 +2307,15 @@
Loading
2307 2307
  };
2308 2308
}
2309 2309
2310 +
2311 +
exports.deleteReqHeaders = function(req) {
2312 +
  var delReqHeaders = parseDeleteProperties(req).reqHeaders;
2313 +
  var headers = req.headers;
2314 +
  Object.keys(delReqHeaders).forEach(function(name) {
2315 +
    delete headers[name];
2316 +
  });
2317 +
};
2318 +
2310 2319
exports.parseDeleteProperties = parseDeleteProperties;
2311 2320
2312 2321
var URL_RE = /^https?:\/\/./;

@@ -227,6 +227,7 @@
Loading
227 227
  
228 228
            var statusCode = util.getStatusCodeFromRule(_rules);
229 229
            if (statusCode) {
230 +
              util.deleteReqHeaders(req);
230 231
              if (statusCode == 200) {
231 232
                resSocket = util.getEmptyRes();
232 233
                var reqDelay = util.getMatcherValue(_rules.reqDelay);
@@ -310,10 +311,7 @@
Loading
310 311
                    resData.port = dstOptions.proxyPort;
311 312
                    dstOptions.host = dstOptions.hostname;
312 313
                    util.setClientId(headers, req.enable, req.disable, req.clientIp, proxyRule.isInternal);
313 -
                    var delReqHeaders = util.parseDeleteProperties(req).reqHeaders;
314 -
                    Object.keys(delReqHeaders).forEach(function(name) {
315 -
                      delete headers[name];
316 -
                    });
314 +
                    util.deleteReqHeaders(req);
317 315
                    var _headers = extend({}, headers);
318 316
                    _headers.host = dstOptions.hostname + ':' + (dstOptions.port || 443);
319 317
                    if (disable.proxyUA) {

@@ -92,6 +92,7 @@
Loading
92 92
    var resHeaders = resData.headers = {};
93 93
    var body = '';
94 94
    var statusMsg;
95 +
    util.deleteReqHeaders(socket);
95 96
    if (status === 101) {
96 97
      statusMsg = 'HTTP/1.1 101 Switching Protocols';
97 98
      var protocol = (headers['sec-websocket-protocol'] || '').split(/, */);
@@ -506,10 +507,7 @@
Loading
506 507
        headers[config.CLIENT_IP_HEAD] = clientIp;
507 508
      }
508 509
    }
509 -
    var delReqHeaders = util.parseDeleteProperties(socket).reqHeaders;
510 -
    Object.keys(delReqHeaders).forEach(function(name) {
511 -
      delete headers[name];
512 -
    });
510 +
    util.deleteReqHeaders(socket);
513 511
    reqSocket.write(socket.getBuffer(headers, options.path));
514 512
    reqSocket.resume();
515 513
    delete headers[config.HTTPS_FIELD];
Files Coverage
biz 67.22%
lib 72.93%
index.js 87.76%
Project Totals (91 files) 72.58%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading