PDA

View Full Version : How to set the HTTP Connection Header to close instead of keep-alive



zbeckerman
28 Jan 2011, 9:56 AM
I tried the code below, but fiddler still shows "Connection: Keep-Alive"



Ext.lib.Ajax._asyncRequest = function(o, method, uri, callback, postData)
{
o.conn.open(method, uri, true);

if (this.useDefaultXhrHeader) {
if (!this.defaultHeaders['X-Requested-With']) {
this.initHeader('X-Requested-With', this.defaultXhrHeader, true);
}
}

if(postData && this.useDefaultHeader && (!this.hasHeaders || !this.headers['Content-Type'])){
this.initHeader('Content-Type', this.defaultPostHeader);
}

if (postData){
this.initHeader('Connection', 'Close');
}

if (this.hasDefaultHeaders || this.hasHeaders) {
this.setHeader(o);
}

this.handleReadyState(o, callback);
o.conn.send(postData || null);

};

zbeckerman
28 Jan 2011, 9:59 AM
I found the following thread, but it provided no answers:
http://www.sencha.com/forum/showthread.php?56645-HTTP-1.1-Header-Connection-gt-Close&referrerid=91380