From ff2d9dfef3cf74d294f9df1659280cffdfb256ba Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Tue, 5 Nov 2019 17:54:33 -0500 Subject: [PATCH] always discard default ports when get/set buffer - fixes #5367 --- packages/server/lib/util/buffers.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/server/lib/util/buffers.js b/packages/server/lib/util/buffers.js index 3bec3c8e23e2..b81305bdc9f6 100644 --- a/packages/server/lib/util/buffers.js +++ b/packages/server/lib/util/buffers.js @@ -20,6 +20,9 @@ module.exports = { }, set (obj = {}) { + obj.url = uri.removeDefaultPort(obj.url) + obj.originalUrl = uri.removeDefaultPort(obj.originalUrl) + return buffers.push(_.pick(obj, 'url', 'originalUrl', 'jar', 'stream', 'response', 'details')) }, @@ -38,17 +41,7 @@ module.exports = { return b } - let parsed = uri.parse(str) - - //# if we're on https and we have a port - //# then attempt to find the buffer by - //# slicing off the port since our buffer - //# was likely stored without a port - if ((parsed.protocol === 'https:') && parsed.port) { - parsed = uri.removePort(parsed) - - return find(parsed.format()) - } + return find(uri.removeDefaultPort(str)) }, take (str) {