-/* $Id: httpd.js,v 1.48 2005/07/10 02:31:33 mmondor Exp $ */
+/* $Id: httpd.js,v 1.49 2005/07/10 18:18:27 mmondor Exp $ */
/*
* Copyright (c) 2005, Matthew Mondor
* easily specify their required access level, which must be met by a
* currently logged in user, which is otherwise redirected to an
* application-specific page.
+ * - Implement logging
+ * - It might be nice to implement a minimal database-like facility, where
+ * for performance we could log changes, and only sync to disk once in a
+ * while, discarding obsolete logs... JSON would be used
*/
* Server identification
*/
SERVER_VERSION = 'mmondor_js_httpd/0.0.1 (NetBSD)';
-SERVER_CVSID = '$Id: httpd.js,v 1.48 2005/07/10 02:31:33 mmondor Exp $';
+SERVER_CVSID = '$Id: httpd.js,v 1.49 2005/07/10 18:18:27 mmondor Exp $';
words[0], words[1]);
} else if (words[0] == 'User-Agent:') {
this.http_agent = lines[i].substr(12);
- if (this.http_agent.indexOf('MSIE') != -1)
+ if (options.ban_msie == true &&
+ this.http_agent.indexOf('MSIE') != -1)
evil = true;
} else if (words[0] == 'Content-Length:')
this.http_content_length = words[1].valueOf();
-/* $Id: ml_clean.js,v 1.1 2005/06/28 02:35:19 mmondor Exp $ */
+/* $Id: ml_clean.js,v 1.2 2005/07/10 18:18:27 mmondor Exp $ */
/*
* Copyright (c) 2004-2005, Matthew Mondor
return str;
}
}
+
+
+var entitites_table = {
+ '<': '<',
+ '>': '>',
+ '&': '&',
+ '"': '"',
+ "`": '‘',
+ "'": '’'
+};
+
+/*
+ * Function to convert a supplied string to use HTML/SGML special entitites.
+ * This also allows HTML escaping from user-supplied strings.
+ */
+function toHTMLEntities(str)
+{
+ var s = '';
+ var i, t, c, e;
+
+ for (i = 0, t = str.length; i < t; i++) {
+ c = str.charAt(i);
+ if ((e = entitites_table[c]) != undefined)
+ s += e;
+ else
+ s += c;
+ }
+
+ return s;
+}
-/* $Id: ml_machine.js,v 1.1 2005/06/28 02:35:19 mmondor Exp $ */
+/* $Id: ml_machine.js,v 1.2 2005/07/10 18:18:27 mmondor Exp $ */
/*
* Copyright (c) 2004-2005, Matthew Mondor
}
}
+
+
+var entitites_table = {
+ '<': '<',
+ '>': '>',
+ '&': '&',
+ '"': '"',
+ "`": '‘',
+ "'": '’'
+};
+
+/*
+ * Function to convert a supplied string to use HTML/SGML special entitites.
+ * This also allows HTML escaping from user-supplied strings.
+ */
+function toHTMLEntities(str)
+{
+ var s = '';
+ var i, t, c, e;
+
+ for (i = 0, t = str.length; i < t; i++) {
+ c = str.charAt(i);
+ if ((e = entitites_table[c]) != undefined)
+ s += e;
+ else
+ s += c;
+ }
+
+ return s;
+}
-/* $Id: options.js,v 1.9 2005/07/09 05:47:01 mmondor Exp $ */
+/* $Id: options.js,v 1.10 2005/07/10 18:18:27 mmondor Exp $ */
var options = {
- /* Maximum number of concurrent clients that we should serve */
max_connections: 32,
- /* Maximum number of concurrent connections per client address */
max_connections_addr: 4,
- /* Transfer I/O timeout in seconds before dropping connection */
io_timeout: 60,
- /* Size of I/O buffer to transfer file/data blocks */
readbuf_size: 16384,
- /* Default virtual host site to use */
default_vhost: "hal.xisop",
- /* Default mimetype to use when none matching file extension */
default_mimetype: "application/octet-stream",
default_charset: "us-ascii",
default_session_exp: 1800,
sess_gc_interval: 600,
- sess_id_size: 64
+ sess_id_size: 64,
+ ban_msie: true
};
/* Address:port combinations to listen to */