Skip to content

Commit

Permalink
paypro: pem parsing - rename variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Sep 6, 2014
1 parent 6e329b1 commit 8593ad4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions browser/root-certs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ function getRootCerts(callback) {
+ ' pem = pem.replace(/-----BEGIN CERTIFICATE-----/g, "");\n'
+ ' pem = pem.replace(/-----END CERTIFICATE-----/g, "");\n'
+ ' var parts = pem.trim().split(/(?:\\r?\\n){2,}/);\n'
+ ' var meta = {};\n'
+ ' var headers = {};\n'
+ ' if (parts.length > 1) {\n'
+ ' meta = parts[0].trim().split(/[\\r\\n]/).reduce(function(out, line) {\n'
+ ' headers = parts[0].trim().split(/[\\r\\n]/).reduce(function(out, line) {\n'
+ ' var parts = line.split(/:[ \\t]+/);\n'
+ ' var key = parts[0].trim().toLowerCase();\n'
+ ' var value = (parts.slice(1).join("") || "").trim();\n'
Expand All @@ -78,10 +78,10 @@ function getRootCerts(callback) {
+ ' ? new Buffer(pem, "base64")\n'
+ ' : null;\n'
+ ' return {\n'
+ ' meta: meta,\n'
+ ' headers: headers,\n'
+ ' pem: pem,\n'
+ ' der: der,\n'
+ ' data: der || new Buffer([0])\n'
+ ' body: der || new Buffer([0])\n'
+ ' };\n'
+ '}\n'
+ '\n'
Expand Down
8 changes: 4 additions & 4 deletions lib/common/RootCerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3731,9 +3731,9 @@ function parsePEM(pem) {
pem = pem.replace(/-----BEGIN CERTIFICATE-----/g, "");
pem = pem.replace(/-----END CERTIFICATE-----/g, "");
var parts = pem.trim().split(/(?:\r?\n){2,}/);
var meta = {};
var headers = {};
if (parts.length > 1) {
meta = parts[0].trim().split(/[\r\n]/).reduce(function(out, line) {
headers = parts[0].trim().split(/[\r\n]/).reduce(function(out, line) {
var parts = line.split(/:[ \t]+/);
var key = parts[0].trim().toLowerCase();
var value = (parts.slice(1).join("") || "").trim();
Expand All @@ -3747,10 +3747,10 @@ function parsePEM(pem) {
? new Buffer(pem, "base64")
: null;
return {
meta: meta,
headers: headers,
pem: pem,
der: der,
data: der || new Buffer([0])
body: der || new Buffer([0])
};
}

Expand Down

0 comments on commit 8593ad4

Please sign in to comment.