*** empty log message ***
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 10 Jul 2005 01:58:25 +0000 (01:58 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 10 Jul 2005 01:58:25 +0000 (01:58 +0000)
tests/js-test/js/httpd/httpd.js

index 001d920..d95111c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: httpd.js,v 1.46 2005/07/09 19:15:26 mmondor Exp $ */
+/* $Id: httpd.js,v 1.47 2005/07/10 01:58:25 mmondor Exp $ */
 
 /*
  * Copyright (c) 2005, Matthew Mondor
@@ -111,7 +111,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.46 2005/07/09 19:15:26 mmondor Exp $';
+SERVER_CVSID   = '$Id: httpd.js,v 1.47 2005/07/10 01:58:25 mmondor Exp $';
 
 
 
@@ -194,7 +194,7 @@ var session_randfd = new FD();
 try {
        session_randfd.open('/dev/urandom', FD.O_RDONLY);
 } catch (x) {
-       err.put(x + "\n");
+       err.put(x + "while attempting to open /dev/urandom\n");
        exit();
 }
 
@@ -226,7 +226,7 @@ function Session(time, exp)
        try {
                rval = session_randfd.read(options.sess_id_size);
        } catch (x) {
-               err.put(x + "\n");
+               err.put(x + "while attempting to read from /dev/urandom\n");
        }
        this.sessid = '';
        for (i = 0; i < options.sess_id_size; i++)
@@ -708,6 +708,17 @@ FD.prototype.parseRequest = function(time)
        this.http_vhost = vhosts_table[vhost.toLowerCase()];
 
        /*
+        * Verify if client sent a session cookie, and if it consists of a
+        * valid one, load session data.
+        */
+       if ((sessid = this.http_vars_cookies['SessionID']) != undefined &&
+           (sess = sessions_table[sessid]) != undefined &&
+           sess.expires > time) {
+               this.http_sessid = sessid;
+               this.http_vars_session = sess.variables;
+       }
+
+       /*
         * Fill in associative array with any GET-style supplied
         * variables (as part of the URL).  We want this even for POST method.
         */
@@ -754,17 +765,6 @@ FD.prototype.parseRequest = function(time)
                        return this.parsePost(time);
        }
 
-       /*
-        * Verify if client sent a session cookie, and if it consists of a
-        * valid one, load session data.
-        */
-       if ((sessid = this.http_vars_cookies['SessionID']) != undefined &&
-           (sess = sessions_table[sessid]) != undefined &&
-           sess.expires > time) {
-               this.http_sessid = sessid;
-               this.http_vars_session = sess.variables;
-       }
-
        if (!close)
                close = this.httpRespond(time);
 
@@ -962,7 +962,8 @@ FD.prototype.httpRespond = function(time)
                                o = new JSO(path.real, st.st_mtime,
                                    obj.script);
                        } catch (x) {
-                               err.put(x + "\n");
+                               err.put(x + 'evaluating script ' + path.real
+                                   + "\n");
                                http_error(this, 500, 'Internal Server Error',
                                    'Please try again later.');
                                return true;
@@ -974,7 +975,7 @@ FD.prototype.httpRespond = function(time)
                                obj.script();
                        obj.flush(this, null);
                } catch (x) {
-                       err.put(x + "\n");
+                       err.put(x + 'executing script ' + path.real + "\n");
                        http_error(this, 500, 'Internal Server Error',
                            'Please try again later.');
                }
@@ -1232,7 +1233,7 @@ function main() {
                err.put("No default_vhost property in options, exiting\n");
                exit();
        }
-       if (vhosts_table[options.default_vhost] != undefined)
+       if (vhosts_table[options.default_vhost.toLowerCase()] != undefined)
                default_vhost =
                    vhosts_table[options.default_vhost.toLowerCase()];
        else {