function stripCookieOrLoginInfo(line) {
  var patterns = [
    // Cookie patterns
    /^set-cookie: /i, /^set-cookie2: /i, /^cookie: /i,

    // Unencrypted authentication patterns
    /^authorization: \S*\s*/i, /^proxy-authorization: \S*\s*/i
  ];

  // Prefix will hold the first part of the string that contains no private
  // information.  If null, no part of the string contains private
  // information.
  var prefix = null;
  for (var i = 0; i < patterns.length; i++) {
    var match = patterns[i].exec(line);
    if (match != null) {
      prefix = match[0];
      break;
    }
  }

  // Look for authentication information from data received from the server in
  // multi-round Negotiate authentication.
  if (prefix === null) {
    var challengePatterns =
        [/^www-authenticate: (\S*)\s*/i, /^proxy-authenticate: (\S*)\s*/i];
    for (var i = 0; i < challengePatterns.length; i++) {
      var match = challengePatterns[i].exec(line);
      if (!match)
        continue;

      // If there's no data after the scheme name, do nothing.
      if (match[0].length == line.length)
        break;

      // Ignore lines with commas, as they may contain lists of schemes, and
      // the information we want to hide is Base64 encoded, so has no commas.
      if (line.indexOf(',') >= 0)
        break;

      // Ignore Basic and Digest authentication challenges, as they contain
      // public information.
      if (/^basic$/i.test(match[1]) || /^digest$/i.test(match[1]))
        break;

      prefix = match[0];
      break;
    }
  }

  if (prefix) {
    var suffix = line.slice(prefix.length);
    // If private information has already been removed, keep the line as-is.
    // This is often the case when viewing a loaded log.
    if (suffix.search(/^\[[0-9]+ bytes were stripped\]$/) == -1) {
      return prefix + '[' + suffix.length + ' bytes were stripped]';
    }
  }

  return line;
}
/**
 * Removes a cookie or unencrypted login information from a single HTTP header
 * line, if present, and returns the modified line.  Otherwise, just returns
 * the original line.
 *
 * Note: this logic should be kept in sync with
 * net::ElideHeaderValueForNetLog in net/http/http_log_util.cc.
 */
Removes a cookie or unencrypted login information from a single HTTP header
line, if present, and returns the modified line.  Otherwise, just returns
the original line.

this logic should be kept in sync with
net::ElideHeaderValueForNetLog in net/http/http_log_util.cc.
Removes a cookie or unencrypted login information from a single HTTP header line if present and returns the modified line . Otherwise just returns the original line . this logic should be kept in sync with net :: ElideHeaderValueForNetLog in net / http / http_log_util . cc .
function stripCookieOrLoginInfo(line) {
  var patterns = [
    /^set-cookie: /i, /^set-cookie2: /i, /^cookie: /i,
    /^authorization: \S*\s*/i, /^proxy-authorization: \S*\s*/i
  ];
  var prefix = null;
  for (var i = 0; i < patterns.length; i++) {
    var match = patterns[i].exec(line);
    if (match != null) {
      prefix = match[0];
      break;
    }
  }
  if (prefix === null) {
    var challengePatterns =
        [/^www-authenticate: (\S*)\s*/i, /^proxy-authenticate: (\S*)\s*/i];
    for (var i = 0; i < challengePatterns.length; i++) {
      var match = challengePatterns[i].exec(line);
      if (!match)
        continue;
      if (match[0].length == line.length)
        break;
      if (line.indexOf(',') >= 0)
        break;
      if (/^basic$/i.test(match[1]) || /^digest$/i.test(match[1]))
        break;
      prefix = match[0];
      break;
    }
  }
  if (prefix) {
    var suffix = line.slice(prefix.length);
    if (suffix.search(/^\[[0-9]+ bytes were stripped\]$/) == -1) {
      return prefix + '[' + suffix.length + ' bytes were stripped]';
    }
  }
  return line;
}
function stripCookieOrLoginInfo ( line ) { var patterns = [ / ^set-cookie:  / i , / ^set-cookie2:  / i , / ^cookie:  / i , / ^authorization: \S*\s* / i , / ^proxy-authorization: \S*\s* / i ] ; var prefix = null ; for ( var i = 0 ; i < patterns . length ; i ++ ) { var match = patterns [ i ] . exec ( line ) ; if ( match != null ) { prefix = match [ 0 ] ; break ; } } if ( prefix === null ) { var challengePatterns = [ / ^www-authenticate: (\S*)\s* / i , / ^proxy-authenticate: (\S*)\s* / i ] ; for ( var i = 0 ; i < challengePatterns . length ; i ++ ) { var match = challengePatterns [ i ] . exec ( line ) ; if ( ! match ) continue ; if ( match [ 0 ] . length == line . length ) break ; if ( line . indexOf ( ',' ) >= 0 ) break ; if ( / ^basic$ / i . test ( match [ 1 ] ) || / ^digest$ / i . test ( match [ 1 ] ) ) break ; prefix = match [ 0 ] ; break ; } } if ( prefix ) { var suffix = line . slice ( prefix . length ) ; if ( suffix . search ( / ^\[[0-9]+ bytes were stripped\]$ / ) == - 1 ) { return prefix + '[' + suffix . length + ' bytes were stripped]' ; } } return line ; }
Removes a cookie or unencrypted login information from a single HTTP header
 line, if present, and returns the modified line.
Removes a cookie or unencrypted login information from a single HTTP header line if present and returns the modified line .
// Cookie patterns // Unencrypted authentication patterns // Prefix will hold the first part of the string that contains no private // information.  If null, no part of the string contains private // information. // Look for authentication information from data received from the server in // multi-round Negotiate authentication. // If there's no data after the scheme name, do nothing. // Ignore lines with commas, as they may contain lists of schemes, and // the information we want to hide is Base64 encoded, so has no commas. // Ignore Basic and Digest authentication challenges, as they contain // public information. // If private information has already been removed, keep the line as-is. // This is often the case when viewing a loaded log.