Make header field case insensitive

#315: Header field name is now case insensitive
main
Camille Barneaud 11 years ago
parent 57c3c313d9
commit 6af4090231

@ -26,7 +26,7 @@
headers.forEach(function(line) {
if ( line ) {
name = line.substring(0, line.indexOf(': '));
name = line.substring(0, line.indexOf(': ')).toLowerCase();
value = line.substring(line.indexOf(': ') + 2, line.length - 1);
responseHeaders[name] = value;

@ -100,7 +100,7 @@
var headers = {};
request.nsIHttpChannel.visitResponseHeaders(function(header, value) {
headers[header] = value;
headers[header.toLowerCase()] = value;
});
w.analyze(progress.currentURI.host, progress.currentURI.spec, { headers: headers });

@ -136,7 +136,7 @@ class Wappalyzer
if ( strpos(trim($line), ': ') !== false ) {
list($key, $value) = explode(': ', $line);
$result->headers[$key] = $value;
$result->headers[strtolower($key)] = $value;
}
}

@ -18,7 +18,7 @@ class Wappalyzer
uri, body, headers = URI(url), nil, {}
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :open_timeout => 5) do |http|
resp = http.get(uri.request_uri)
resp.canonical_each{|k,v| headers[k] = v}
resp.each_header{|k,v| headers[k.downcase] = v}
body = resp.body.encode('UTF-8', :invalid => :replace, :undef => :replace)
end

@ -351,8 +351,8 @@ var wappalyzer = (function() {
for ( header in w.apps[app].headers ) {
parse(w.apps[app][type][header]).map(function(pattern) {
if ( typeof data[type][header] === 'string' && pattern.regex.test(data[type][header]) ) {
apps[app].setDetected(pattern, type, data[type][header], header);
if ( typeof data[type][header.toLowerCase()] === 'string' && pattern.regex.test(data[type][header.toLowerCase()]) ) {
apps[app].setDetected(pattern, type, data[type][header.toLowerCase()], header);
}
profiler.checkPoint(app, type, pattern.regex);
});