GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/99689


Change subject: Minor cleanup: Only forward cookie if set
......................................................................

Minor cleanup: Only forward cookie if set

These forwarded cookies did not affect caching, so were relatively harmless.
Still good to avoid sending invalid cookies.

Change-Id: Iee23d14eec67c5cf407bb7a257440f8f704e9f1c
---
M js/lib/mediawiki.ApiRequest.js
1 file changed, 24 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/89/99689/1

diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js
index c49da4f..551bc2d 100644
--- a/js/lib/mediawiki.ApiRequest.js
+++ b/js/lib/mediawiki.ApiRequest.js
@@ -243,11 +243,14 @@
                proxy: env.conf.parsoid.apiProxyURI,
                headers: {
                        'User-Agent': userAgent,
-                       'Cookie': env.cookie,
                        'Connection': 'close'
 
                }
        };
+       if (env.cookie) {
+               // Forward the cookie if set
+               this.requestOptions.headers.Cookie = env.cookie;
+       }
 
        // Start the request
        this.request( this.requestOptions, this._requestCB.bind(this) );
@@ -375,10 +378,14 @@
                proxy: env.conf.parsoid.apiProxyURI,
                headers: {
                        'User-Agent': userAgent,
-                       'Cookie': env.cookie,
                        'Connection': 'close'
                }
        };
+
+       if (env.cookie) {
+               // Forward the cookie if set
+               this.requestOptions.headers.Cookie = env.cookie;
+       }
 
        // Start the request
        this.request( this.requestOptions, this._requestCB.bind(this) );
@@ -474,10 +481,14 @@
                proxy: env.conf.parsoid.apiProxyURI,
                headers: {
                        'User-Agent': userAgent,
-                       'Cookie': env.cookie,
                        'Connection': 'close'
                }
        };
+
+       if (env.cookie) {
+               // Forward the cookie if set
+               this.requestOptions.headers.Cookie = env.cookie;
+       }
 
        // Start the request
        this.request( this.requestOptions, this._requestCB.bind(this) );
@@ -646,10 +657,15 @@
                proxy: env.conf.parsoid.apiProxyURI,
                headers: {
                        'User-Agent': userAgent,
-                       'Cookie': env.cookie,
                        'Connection': 'close'
                }
        };
+
+       if (env.cookie) {
+               // Forward the cookie if set
+               this.requestOptions.headers.Cookie = env.cookie;
+       }
+
 
        this.request( this.requestOptions, this._requestCB.bind( this ) );
 };
@@ -738,10 +754,13 @@
                proxy: env.conf.parsoid.apiProxyURI,
                headers: {
                        'User-Agent': userAgent,
-                       'Cookie': env.cookie,
                        'Connection': 'close'
                }
        };
+       if (env.cookie) {
+               // Forward the cookie if set
+               this.requestOptions.headers.Cookie = env.cookie;
+       }
 
        this.request( this.requestOptions, this._requestCB.bind( this ) );
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/99689
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee23d14eec67c5cf407bb7a257440f8f704e9f1c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to