[Pkg-javascript-commits] [sockjs-client] 25/434: Let chrome/safari not shout for XHR.

Tonnerre Lombard tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:46:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch master
in repository sockjs-client.

commit b68c592c57524c57a5a5f5c60d03c4cce65fa912
Author: Marek Majkowski <majek04 at gmail.com>
Date:   Tue Jul 26 16:49:20 2011 +0100

    Let chrome/safari not shout for XHR.
---
 lib/utils.js | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/utils.js b/lib/utils.js
index f20b251..27660c6 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -58,17 +58,23 @@ utils.objectExtend = function(dst, src) {
     return dst;
 };
 
+// Try to clear some headers, in order to save bandwidth. For
+// reference see:
+//   http://blog.mibbit.com/?p=143
+//   http://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest
 var xhrDefaultHeaders = {
-   // "User-Agent": '',
-   // "Accept-Encoding": '',
-   // "Accept-Charset": '',
-   // "Connection": "keep-alive",
-   // "Keep-Alive": '',
+    "User-Agent": '',
     "Accept": '',
     "Accept-Language": '',
     "Content-Type": "T"
 };
 
+if (navigator &&
+    (navigator.userAgent.indexOf('Chrome')!= -1 ||
+     navigator.userAgent.indexOf('Safari') != -1)) {
+    delete xhrDefaultHeaders['User-Agent'];
+}
+
 utils.createXHR = function(method, url, payload, callback) {
     var xhr;
     if (_window.ActiveXObject) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list