HTTP headers parser

by Mohan 2012-09-20 23:43:40


HTTP headers parser
var rexp_keyval = /(.*?): ?(.*?)\r?\n/g;
function headersToObject( allHeaders ) {

var res, hdrObj = {};
for ( rexp_keyval.lastIndex = 0; res = rexp_keyval.exec(allHeaders); hdrObj[res[1]] = res[2])
return hdrObj;
}


973
like
0
dislike
0
mail
flag

You must LOGIN to add comments