Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: chrome/browser/resources/net_internals/log_view_painter.js

Issue 1360253002: Log GOAWAY frame debug data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // TODO(eroman): put these methods into a namespace. 5 // TODO(eroman): put these methods into a namespace.
6 6
7 var createLogEntryTablePrinter; 7 var createLogEntryTablePrinter;
8 var proxySettingsToString; 8 var proxySettingsToString;
9 var stripCookiesAndLoginInfo; 9 var stripCookiesAndLoginInfo;
10 10
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 headers.push(key + ': ' + entry.params.headers[key]); 472 headers.push(key + ': ' + entry.params.headers[key]);
473 entry.params.headers = headers; 473 entry.params.headers = headers;
474 474
475 return entry; 475 return entry;
476 } 476 }
477 477
478 /** 478 /**
479 * Removes a cookie or unencrypted login information from a single HTTP header 479 * Removes a cookie or unencrypted login information from a single HTTP header
480 * line, if present, and returns the modified line. Otherwise, just returns 480 * line, if present, and returns the modified line. Otherwise, just returns
481 * the original line. 481 * the original line.
482 *
483 * Note: this logic should be kept in sync with
484 * net::ElideHeaderValueForNetLog in net/http/http_log_util.cc.
482 */ 485 */
483 function stripCookieOrLoginInfo(line) { 486 function stripCookieOrLoginInfo(line) {
484 var patterns = [ 487 var patterns = [
485 // Cookie patterns 488 // Cookie patterns
486 /^set-cookie: /i, 489 /^set-cookie: /i,
487 /^set-cookie2: /i, 490 /^set-cookie2: /i,
488 /^cookie: /i, 491 /^cookie: /i,
489 492
490 // Unencrypted authentication patterns 493 // Unencrypted authentication patterns
491 /^authorization: \S*\s*/i, 494 /^authorization: \S*\s*/i,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (suffix.search(/^\[[0-9]+ bytes were stripped\]$/) == -1 && 543 if (suffix.search(/^\[[0-9]+ bytes were stripped\]$/) == -1 &&
541 suffix != '[value was stripped]') { 544 suffix != '[value was stripped]') {
542 return prefix + '[' + suffix.length + ' bytes were stripped]'; 545 return prefix + '[' + suffix.length + ' bytes were stripped]';
543 } 546 }
544 } 547 }
545 548
546 return line; 549 return line;
547 } 550 }
548 551
549 /** 552 /**
553 * Remove debug data from HTTP/2 GOAWAY frame due to privacy considerations, see
554 * https://httpwg.github.io/specs/rfc7540.html#GOAWAY.
555 *
556 * Note: this logic should be kept in sync with
557 * net::ElideGoAwayDebugDataForNetLog in net/http/http_log_util.cc.
558 */
559 function stripGoAwayDebugData(value) {
560 return '[' + value.length + ' bytes were stripped]';
561 }
562
563 /**
550 * If |entry| has headers, returns a copy of |entry| with all cookie and 564 * If |entry| has headers, returns a copy of |entry| with all cookie and
551 * unencrypted login text removed. Otherwise, returns original |entry| object. 565 * unencrypted login text removed. Otherwise, returns original |entry| object.
552 * This is needed so that JSON log dumps can be made without affecting the 566 * This is needed so that JSON log dumps can be made without affecting the
553 * source data. Converts headers stored in objects to arrays. 567 * source data. Converts headers stored in objects to arrays.
554 *
555 * Note: this logic should be kept in sync with
556 * net::ElideHeaderForNetLog in net/http/http_log_util.cc.
557 */ 568 */
558 stripCookiesAndLoginInfo = function(entry) { 569 stripCookiesAndLoginInfo = function(entry) {
559 if (!entry.params || entry.params.headers === undefined || 570 if (!entry.params) {
571 return entry;
572 }
573
574 if (entry.params.goaway_debug_data != undefined) {
575 // Duplicate the top level object, and |entry.params|. All other fields are
576 // just pointers to the original values, as they won't be modified, other
577 // than |entry.params.goaway_debug_data|.
578 entry = shallowCloneObject(entry);
579 entry.params = shallowCloneObject(entry.params);
580 entry.params.goaway_debug_data =
581 stripGoAwayDebugData(entry.params.goaway_debug_data);
582 return entry;
583 }
584
585 if (entry.params.headers === undefined ||
560 !(entry.params.headers instanceof Object)) { 586 !(entry.params.headers instanceof Object)) {
561 return entry; 587 return entry;
562 } 588 }
563 589
564 // Make sure entry's headers are in an array. 590 // Make sure entry's headers are in an array.
565 entry = reformatHeaders(entry); 591 entry = reformatHeaders(entry);
566 592
567 // Duplicate the top level object, and |entry.params|. All other fields are 593 // Duplicate the top level object, and |entry.params|. All other fields are
568 // just pointers to the original values, as they won't be modified, other than 594 // just pointers to the original values, as they won't be modified, other than
569 // |entry.params.headers|. 595 // |entry.params.headers|.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 } 803 }
778 804
779 if (config.source != undefined && config.source != 'UNKNOWN') 805 if (config.source != undefined && config.source != 'UNKNOWN')
780 result.push('Source: ' + config.source); 806 result.push('Source: ' + config.source);
781 807
782 return result.join('\n'); 808 return result.join('\n');
783 }; 809 };
784 810
785 // End of anonymous namespace. 811 // End of anonymous namespace.
786 })(); 812 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/net_internals/log_view_painter.js » ('j') | net/spdy/buffered_spdy_framer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698