From 9a1cb623369137f62216770e792ff2a0ae04ef16 Mon Sep 17 00:00:00 2001 From: yssk22 Date: Sat, 27 Apr 2013 12:39:40 +0900 Subject: [PATCH 1/2] Cookie attribute name should be case-insensitive --- lib/cookie/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cookie/index.js b/lib/cookie/index.js index 2fe9907..3cda489 100644 --- a/lib/cookie/index.js +++ b/lib/cookie/index.js @@ -28,7 +28,7 @@ var Cookie = exports = module.exports = function Cookie(str, req) { // Map the key/val pairs str.split(/ *; */).reduce(function(obj, pair){ pair = pair.split(/ *= */); - obj[pair[0]] = pair[1] || true; + obj[pair[0].toLowerCase()] = pair[1] || true; return obj; }, this); From 8453c32a9a0e9a6ca90c57ba2789bca1f985aedf Mon Sep 17 00:00:00 2001 From: yssk22 Date: Sat, 27 Apr 2013 12:57:57 +0900 Subject: [PATCH 2/2] support to take tls options for a request. This feature must required to request the server with self-signed certificate since 'rejectUnauthorized' is false by default from node 0.10.x --- lib/browser.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/browser.js b/lib/browser.js index 15c3a34..100874e 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -212,13 +212,26 @@ Browser.prototype.request = function(method, path, options, fn, saveHistory){ } // Request - var req = (this.https ? https : http).request({ + var reqOpts = { method: method , path: path , port: this.host ? this.port : (server && server.__port) , host: this.host , headers: headers - }); + }; + var req; + if (this.https){ + if( options.tlsOpts ){ + ["pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized"].forEach(function(name){ + if( options.tlsOpts[name] !== undefined ){ + reqOpts[name] = options.tlsOpts[name]; + } + }); + } + req = https.request(reqOpts); + }else{ + req = http.request(reqOpts); + } req.on('response', function(res){ var status = res.statusCode , buf = '';