From e5e7511245566c2a49281e1ce29eb9fb8f90be5c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 17 Dec 2011 01:37:25 +0100 Subject: [PATCH] MINOR Patching prototype.js connection closing to avoid JS errors (see pull request #106) --- thirdparty/prototype/prototype.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/thirdparty/prototype/prototype.js b/thirdparty/prototype/prototype.js index 919834b41..a499541e0 100644 --- a/thirdparty/prototype/prototype.js +++ b/thirdparty/prototype/prototype.js @@ -778,12 +778,13 @@ Ajax.Request.prototype = Object.extend(new Ajax.Base(), { requestHeaders.push('Content-type', 'application/x-www-form-urlencoded; charset=utf-8'); - /* Force "Connection: close" for Mozilla browsers to work around - * a bug where XMLHttpReqeuest sends an incorrect Content-length - * header. See Mozilla Bugzilla #246651. + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. */ - if (this.transport.overrideMimeType) - requestHeaders.push('Connection', 'close'); + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; } if (this.options.requestHeaders)