lib/abaaso.js
function ( xhr, uri, type ) {
		var headers = string.trim( xhr.getAllResponseHeaders() ).split( "\n" ),
		    items   = {},
		    o       = {},
		    allow   = null,
		    expires = new Date(),
		    cors    = client.cors( uri );

		array.each( headers, function ( i ) {
			var header, value;

			value         = i.replace( regex.header_value_replace, "" );
			header        = i.replace( regex.header_replace, "" );
			header        = string.unhyphenate( header, true ).replace( /\s+/g, "-" );
			items[header] = value;

			if ( allow === null ) {
				if ( ( !cors && regex.allow.test( header) ) || ( cors && regex.allow_cors.test( header) ) ) {
					allow = value;
				}
			}
		});

		if ( regex.no.test( items["Cache-Control"] ) ) {
			// Do nothing
		}
		else if ( items["Cache-Control"] !== undefined && regex.number_present.test( items["Cache-Control"] ) ) {
			expires = expires.setSeconds( expires.getSeconds() + number.parse( regex.number_present.exec( items["Cache-Control"] )[0], 10 ) );
		}
		else if ( items.Expires !== undefined ) {
			expires = new Date( items.Expires );
		}
		else {
			expires = expires.setSeconds( expires.getSeconds() + $.expires );
		}

		o.expires    = expires;
		o.headers    = items;
		o.permission = client.bit( allow !== null ? string.explode( allow ) : [type] );

		if ( type === "get" ) {
			cache.set( uri, "expires",    o.expires );
			cache.set( uri, "headers",    o.headers );
			cache.set( uri, "permission", o.permission );
		}

		return o;
	}
function ( xhr, uri, type ) {
		var headers = string.trim( xhr.getAllResponseHeaders() ).split( "\n" ),
		    items   = {},
		    o       = {},
		    allow   = null,
		    expires = new Date(),
		    cors    = client.cors( uri );

		array.each( headers, function ( i ) {
			var header, value;

			value         = i.replace( regex.header_value_replace, "" );
			header        = i.replace( regex.header_replace, "" );
			header        = string.unhyphenate( header, true ).replace( /\s+/g, "-" );
			items[header] = value;

			if ( allow === null ) {
				if ( ( !cors && regex.allow.test( header) ) || ( cors && regex.allow_cors.test( header) ) ) {
					allow = value;
				}
			}
		});

		if ( regex.no.test( items["Cache-Control"] ) ) {
			// Do nothing
		}
		else if ( items["Cache-Control"] !== undefined && regex.number_present.test( items["Cache-Control"] ) ) {
			expires = expires.setSeconds( expires.getSeconds() + number.parse( regex.number_present.exec( items["Cache-Control"] )[0], 10 ) );
		}
		else if ( items.Expires !== undefined ) {
			expires = new Date( items.Expires );
		}
		else {
			expires = expires.setSeconds( expires.getSeconds() + $.expires );
		}

		o.expires    = expires;
		o.headers    = items;
		o.permission = client.bit( allow !== null ? string.explode( allow ) : [type] );

		if ( type === "get" ) {
			cache.set( uri, "expires",    o.expires );
			cache.set( uri, "headers",    o.headers );
			cache.set( uri, "permission", o.permission );
		}

		return o;
	}
function ( xhr , uri , type ) { var headers = string . trim ( xhr . getAllResponseHeaders ( ) ) . split ( "\n" ) , items = { } , o = { } , allow = null , expires = new Date ( ) , cors = client . cors ( uri ) ; array . each ( headers , function ( i ) { var header , value ; value = i . replace ( regex . header_value_replace , "" ) ; header = i . replace ( regex . header_replace , "" ) ; header = string . unhyphenate ( header , true ) . replace ( / \s+ / g , "-" ) ; items [ header ] = value ; if ( allow === null ) { if ( ( ! cors && regex . allow . test ( header ) ) || ( cors && regex . allow_cors . test ( header ) ) ) { allow = value ; } } } ) ; if ( regex . no . test ( items [ "Cache-Control" ] ) ) { // Do nothing } else if ( items [ "Cache-Control" ] !== undefined && regex . number_present . test ( items [ "Cache-Control" ] ) ) { expires = expires . setSeconds ( expires . getSeconds ( ) + number . parse ( regex . number_present . exec ( items [ "Cache-Control" ] ) [ 0 ] , 10 ) ) ; } else if ( items . Expires !== undefined ) { expires = new Date ( items . Expires ) ; } else { expires = expires . setSeconds ( expires . getSeconds ( ) + $ . expires ) ; } o . expires = expires ; o . headers = items ; o . permission = client . bit ( allow !== null ? string . explode ( allow ) : [ type ] ) ; if ( type === "get" ) { cache . set ( uri , "expires" , o . expires ) ; cache . set ( uri , "headers" , o . headers ) ; cache . set ( uri , "permission" , o . permission ) ; } return o ; }
Caches the headers from the XHR response

@method headers
@param  {Object} xhr  XMLHttpRequest Object
@param  {String} uri  URI to request
@param  {String} type Type of request
@return {Object}      Cached URI representation
Caches the headers from the XHR response