nfarahani
22 Feb 2007, 2:16 PM
I noticed that there is a problem with the connection manager when using the new YUI 2.2.0 release (out 2/20/07) and the YUI-EXT available on the main site (0.33); maybe someone can further clarify, but what I've noticed is that the "setHeader" method in connection.js of the YUI library has been updated. This method is overridden in the yui-ext.js file; which I believe to be the root of the problem. Commenting the override in yui-ext.js fixes the problem -- and data gets posted properly. Can anyone advise on this issue? I appreciate the help... the code differences are pasted below:
======================================
| YUI-EXT 0.33
======================================
if(YAHOO.util.Connect){
YAHOO.util.Connect.setHeader = function(o){
for(var prop in this._http_header){
if(typeof this._http_header[prop] != 'function'){
o.conn.setRequestHeader(prop, this._http_header[prop]);
}
}
delete this._http_header;
this._http_header = {};
this._has_http_headers = false;
};
}
======================================
| YUI 0.12.2
======================================
/**
* @description Accessor that sets the HTTP headers for each transaction.
* @method setHeader
* @private
* @static
* @param {object} o The connection object for the transaction.
* @return {void}
*/
setHeader:function(o)
{
for(var prop in this._http_header){
if(this._http_header.hasOwnProperty(prop)){
o.conn.setRequestHeader(prop, this._http_header[prop]);
}
}
delete this._http_header;
this._http_header = {};
this._has_http_headers = false;
}
======================================
| YUI 2.2.0
======================================
/**
* @description Accessor that sets the HTTP headers for each transaction.
* @method setHeader
* @private
* @static
* @param {object} o The connection object for the transaction.
* @return {void}
*/
setHeader:function(o)
{
if(this._has_default_headers){
for(var prop in this._default_headers){
if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){
o.conn.setRequestHeader(prop, this._default_headers[prop]);
YAHOO.log('Default HTTP header ' + prop + ' set with value of ' + this._default_headers[prop], 'info', 'Connection');
}
}
}
if(this._has_http_headers){
for(var prop in this._http_headers){
if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){
o.conn.setRequestHeader(prop, this._http_headers[prop]);
YAHOO.log('HTTP header ' + prop + ' set with value of ' + this._http_headers[prop], 'info', 'Connection');
}
}
delete this._http_headers;
this._http_headers = {};
this._has_http_headers = false;
}
},
My resolution so far is to comment out Jack's override of the setHeader method (not sure the necessity of it) -- perhaps a new override is needed if the changes that were made are important.
======================================
| YUI-EXT 0.33
======================================
if(YAHOO.util.Connect){
YAHOO.util.Connect.setHeader = function(o){
for(var prop in this._http_header){
if(typeof this._http_header[prop] != 'function'){
o.conn.setRequestHeader(prop, this._http_header[prop]);
}
}
delete this._http_header;
this._http_header = {};
this._has_http_headers = false;
};
}
======================================
| YUI 0.12.2
======================================
/**
* @description Accessor that sets the HTTP headers for each transaction.
* @method setHeader
* @private
* @static
* @param {object} o The connection object for the transaction.
* @return {void}
*/
setHeader:function(o)
{
for(var prop in this._http_header){
if(this._http_header.hasOwnProperty(prop)){
o.conn.setRequestHeader(prop, this._http_header[prop]);
}
}
delete this._http_header;
this._http_header = {};
this._has_http_headers = false;
}
======================================
| YUI 2.2.0
======================================
/**
* @description Accessor that sets the HTTP headers for each transaction.
* @method setHeader
* @private
* @static
* @param {object} o The connection object for the transaction.
* @return {void}
*/
setHeader:function(o)
{
if(this._has_default_headers){
for(var prop in this._default_headers){
if(YAHOO.lang.hasOwnProperty(this._default_headers,prop)){
o.conn.setRequestHeader(prop, this._default_headers[prop]);
YAHOO.log('Default HTTP header ' + prop + ' set with value of ' + this._default_headers[prop], 'info', 'Connection');
}
}
}
if(this._has_http_headers){
for(var prop in this._http_headers){
if(YAHOO.lang.hasOwnProperty(this._http_headers,prop)){
o.conn.setRequestHeader(prop, this._http_headers[prop]);
YAHOO.log('HTTP header ' + prop + ' set with value of ' + this._http_headers[prop], 'info', 'Connection');
}
}
delete this._http_headers;
this._http_headers = {};
this._has_http_headers = false;
}
},
My resolution so far is to comment out Jack's override of the setHeader method (not sure the necessity of it) -- perhaps a new override is needed if the changes that were made are important.