-/* $Id: httpd.js,v 1.41 2006/10/27 05:20:41 mmondor Exp $ */
+/* $Id: httpd.js,v 1.42 2006/11/16 06:59:18 mmondor Exp $ */
/*
* Copyright (c) 2005-2006, Matthew Mondor
* Server identification
*/
const SERVER_VERSION = 'mmondor_js_httpd/0.1.0 (NetBSD)';
-const SERVER_CVSID = '$Id: httpd.js,v 1.41 2006/10/27 05:20:41 mmondor Exp $';
+const SERVER_CVSID = '$Id: httpd.js,v 1.42 2006/11/16 06:59:18 mmondor Exp $';
var evil_browser = evil_os = false;
var vhost = '';
var lines;
- var words;
+ var words, w;
var i;
/*
var sessid, sess;
/*
* Parse header for interesting lines.
+ * The element name is case-insensitive.
*/
if (valid && !this.http_old_get) {
for (i in lines) {
words = lines[i].split(' ');
- if (words[0] == 'Host:' && words.length == 2) {
+ w = words[0].toLowerCase();
+ if (w == 'host:' && words.length == 2) {
var i2;
if ((i2 = words[1].indexOf(':')) != -1)
words[1] = words[1].substr(0, i2);
vhost = words[1];
- } else if (words[0] == 'Cookie:') {
+ } else if (w == 'cookie:') {
words = (lines[i].substr(8)).split('=');
if (words.length == 2) {
property_add(this.http_vars_cookies,
words[0], words[1]);
this.http_vars_cookies_count++;
}
- } else if (words[0] == 'User-Agent:') {
+ } else if (w == 'user-agent:') {
this.http_agent = lines[i].substr(12);
if (options.ban_msie == true &&
this.http_agent.indexOf('MSIE') != -1)
if (options.ban_windows == true &&
this.http_agent.indexOf('Windows') != -1)
evil_os = true;
- } else if (words[0] == 'Content-Length:' &&
- words.length == 2)
+ } else if (w == 'content-length:' && words.length == 2)
this.http_content_length = words[1].valueOf();
- else if (words[0] == 'If-Modified-Since:')
+ else if (w == 'if-modified-since:')
this.http_modified_since = Math.round(
Date.parse(lines[i].substr(19)) / 1000);
- else if (words[0] == 'Range:')
+ else if (w == 'range:')
this.http_range = lines[i].substr(7);
}
}