*** empty log message ***
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 10 Jul 2005 18:18:27 +0000 (18:18 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 10 Jul 2005 18:18:27 +0000 (18:18 +0000)
tests/js-test/js/httpd/httpd.js
tests/js-test/js/httpd/ml_clean.js
tests/js-test/js/httpd/ml_machine.js
tests/js-test/js/httpd/options.js

index 964edef..6cd2ea8 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
  */
 
 
@@ -111,7 +115,7 @@ eval(file_read('root.js'));         /* Root object for virtual chroot(2) */
  * 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 $';
 
 
 
@@ -667,7 +671,8 @@ FD.prototype.parseRequest = function(time)
                                            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();
index b321100..96f73a9 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -146,3 +146,33 @@ MLTag.prototype = {
                return str;
        }
 }
+
+
+var entitites_table = {
+       '<': '&lt;',
+       '>': '&gt;',
+       '&': '&amp;',
+       '"': '&quot;',
+       "`": '&lsquo;',
+       "'": '&rsquo;'
+};
+
+/*
+ * 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;
+}
index 8ba2ccc..d6b6c01 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -103,3 +103,33 @@ MLTag.prototype = {
        }
 
 }
+
+
+var entitites_table = {
+       '<': '&lt;',
+       '>': '&gt;',
+       '&': '&amp;',
+       '"': '&quot;',
+       "`": '&lsquo;',
+       "'": '&rsquo;'
+};
+
+/*
+ * 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;
+}
index 2012c0f..72c7a70 100644 (file)
@@ -1,22 +1,17 @@
-/* $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 */