| OLD | NEW |
| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 case EventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: | 274 case EventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: |
| 275 case EventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: | 275 case EventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: |
| 276 return writeParamsForRequestHeaders; | 276 return writeParamsForRequestHeaders; |
| 277 | 277 |
| 278 case EventType.PROXY_CONFIG_CHANGED: | 278 case EventType.PROXY_CONFIG_CHANGED: |
| 279 return writeParamsForProxyConfigChanged; | 279 return writeParamsForProxyConfigChanged; |
| 280 | 280 |
| 281 case EventType.CERT_VERIFIER_JOB: | 281 case EventType.CERT_VERIFIER_JOB: |
| 282 case EventType.SSL_CERTIFICATES_RECEIVED: | 282 case EventType.SSL_CERTIFICATES_RECEIVED: |
| 283 return writeParamsForCertificates; | 283 return writeParamsForCertificates; |
| 284 case EventType.EV_CERT_CT_COMPLIANCE_CHECKED: |
| 285 return writeParamsForCheckedEVCertificates; |
| 284 | 286 |
| 285 case EventType.SSL_VERSION_FALLBACK: | 287 case EventType.SSL_VERSION_FALLBACK: |
| 286 return writeParamsForSSLVersionFallback; | 288 return writeParamsForSSLVersionFallback; |
| 287 } | 289 } |
| 288 return null; | 290 return null; |
| 289 } | 291 } |
| 290 | 292 |
| 291 /** | 293 /** |
| 292 * Default parameter writer that outputs a visualization of field named |key| | 294 * Default parameter writer that outputs a visualization of field named |key| |
| 293 * with value |value| to |out|. | 295 * with value |value| to |out|. |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 } | 580 } |
| 579 | 581 |
| 580 // Strip the trailing CRLF that params.line contains. | 582 // Strip the trailing CRLF that params.line contains. |
| 581 var lineWithoutCRLF = params.line.replace(/\r\n$/g, ''); | 583 var lineWithoutCRLF = params.line.replace(/\r\n$/g, ''); |
| 582 out.writeArrowIndentedLines([lineWithoutCRLF].concat(params.headers)); | 584 out.writeArrowIndentedLines([lineWithoutCRLF].concat(params.headers)); |
| 583 | 585 |
| 584 consumedParams.line = true; | 586 consumedParams.line = true; |
| 585 consumedParams.headers = true; | 587 consumedParams.headers = true; |
| 586 } | 588 } |
| 587 | 589 |
| 590 function writeCertificateParam(entry, out, consumerParam, paramName) { |
| 591 var certs = entry.params[paramName].certificates.reduce( |
| 592 function(previous, current) { |
| 593 return previous.concat(current.split('\n')); |
| 594 }, new Array()); |
| 595 out.writeArrowKey(paramName); |
| 596 out.writeSpaceIndentedLines(8, certs); |
| 597 consumedParams[paramName] = true; |
| 598 } |
| 599 |
| 588 /** | 600 /** |
| 589 * Outputs the certificate parameters of |entry| to |out|. | 601 * Outputs the certificate parameters of |entry| to |out|. |
| 590 */ | 602 */ |
| 591 function writeParamsForCertificates(entry, out, consumedParams) { | 603 function writeParamsForCertificates(entry, out, consumedParams) { |
| 592 if (entry.params.certificates instanceof Array) { | 604 if (entry.params.certificates instanceof Array) { |
| 593 var certs = entry.params.certificates.reduce(function(previous, current) { | 605 var certs = entry.params.certificates.reduce(function(previous, current) { |
| 594 return previous.concat(current.split('\n')); | 606 return previous.concat(current.split('\n')); |
| 595 }, new Array()); | 607 }, new Array()); |
| 596 out.writeArrowKey('certificates'); | 608 out.writeArrowKey('certificates'); |
| 597 out.writeSpaceIndentedLines(8, certs); | 609 out.writeSpaceIndentedLines(8, certs); |
| 598 consumedParams.certificates = true; | 610 consumedParams.certificates = true; |
| 599 } | 611 } |
| 600 | 612 |
| 601 if (typeof(entry.params.verified_cert) == 'object') { | 613 if (typeof(entry.params.verified_cert) == 'object') { |
| 602 if (entry.params.verified_cert.certificates instanceof Array) { | 614 if (entry.params.verified_cert.certificates instanceof Array) { |
| 603 var certs = entry.params.verified_cert.certificates.reduce( | 615 writeCertificateParam(entry, out, consumedParams, 'verified_cert'); |
| 604 function(previous, current) { | |
| 605 return previous.concat(current.split('\n')); | |
| 606 }, new Array()); | |
| 607 out.writeArrowKey('verified_cert'); | |
| 608 out.writeSpaceIndentedLines(8, certs); | |
| 609 consumedParams.verified_cert = true; | |
| 610 } | 616 } |
| 611 } | 617 } |
| 612 | 618 |
| 613 if (typeof(entry.params.cert_status) == 'number') { | 619 if (typeof(entry.params.cert_status) == 'number') { |
| 614 var valueStr = entry.params.cert_status + ' (' + | 620 var valueStr = entry.params.cert_status + ' (' + |
| 615 getCertStatusFlagSymbolicString(entry.params.cert_status) + ')'; | 621 getCertStatusFlagSymbolicString(entry.params.cert_status) + ')'; |
| 616 out.writeArrowKeyValue('cert_status', valueStr); | 622 out.writeArrowKeyValue('cert_status', valueStr); |
| 617 consumedParams.cert_status = true; | 623 consumedParams.cert_status = true; |
| 618 } | 624 } |
| 619 | 625 |
| 620 } | 626 } |
| 621 | 627 |
| 628 function writeParamsForCheckedEVCertificates(entry, out, consumedParams) { |
| 629 if (typeof(entry.params.certificate) == 'object') { |
| 630 if (entry.params.certificate.certificates instanceof Array) { |
| 631 writeCertificateParam(entry, out, consumedParams, 'certificate'); |
| 632 } |
| 633 } |
| 634 } |
| 635 |
| 622 /** | 636 /** |
| 623 * Outputs the SSL version fallback parameters of |entry| to |out|. | 637 * Outputs the SSL version fallback parameters of |entry| to |out|. |
| 624 */ | 638 */ |
| 625 function writeParamsForSSLVersionFallback(entry, out, consumedParams) { | 639 function writeParamsForSSLVersionFallback(entry, out, consumedParams) { |
| 626 var params = entry.params; | 640 var params = entry.params; |
| 627 | 641 |
| 628 if (typeof params.version_before != 'number' || | 642 if (typeof params.version_before != 'number' || |
| 629 typeof params.version_after != 'number') { | 643 typeof params.version_after != 'number') { |
| 630 // Unrecognized params. | 644 // Unrecognized params. |
| 631 return; | 645 return; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 } | 779 } |
| 766 | 780 |
| 767 if (config.source != undefined && config.source != 'UNKNOWN') | 781 if (config.source != undefined && config.source != 'UNKNOWN') |
| 768 result.push('Source: ' + config.source); | 782 result.push('Source: ' + config.source); |
| 769 | 783 |
| 770 return result.join('\n'); | 784 return result.join('\n'); |
| 771 }; | 785 }; |
| 772 | 786 |
| 773 // End of anonymous namespace. | 787 // End of anonymous namespace. |
| 774 })(); | 788 })(); |
| OLD | NEW |