*** empty log message ***
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 9 Jul 2005 10:21:04 +0000 (10:21 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sat, 9 Jul 2005 10:21:04 +0000 (10:21 +0000)
tests/js-test/js/httpd/httpd.js

index 37c3450..81b7aed 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: httpd.js,v 1.41 2005/07/09 08:23:07 mmondor Exp $ */
+/* $Id: httpd.js,v 1.42 2005/07/09 10:21:04 mmondor Exp $ */
 
 /*
  * Copyright (c) 2005, Matthew Mondor
@@ -106,7 +106,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.41 2005/07/09 08:23:07 mmondor Exp $';
+SERVER_CVSID   = '$Id: httpd.js,v 1.42 2005/07/09 10:21:04 mmondor Exp $';
 
 
 
@@ -213,9 +213,14 @@ function session_gc(time)
 
 function Session(time, exp)
 {
-       var rval = session_randfd.read(options.sess_id_size);
+       var rval;
        var i;
 
+       try {
+               rval = session_randfd.read(options.sess_id_size);
+       } catch (x) {
+               err.put(x + "\n");
+       }
        this.sessid = '';
        for (i = 0; i < options.sess_id_size; i++)
                this.sessid +=
@@ -370,6 +375,7 @@ function process_query(time)
        var done = false;
        var close = false;
        var idx;
+       var data;
 
        /*
         * If we reach a request of 32768 bytes, stop reading.
@@ -387,7 +393,10 @@ function process_query(time)
                done = true;
        else {
                try {
-                       this.request_data += this.read(len);
+                       data = this.read(len);
+                       if (data.length == 0)
+                               close = true;
+                       this.request_data += data;
                        this.updateTimeout(time);
                } catch (x) {
                        if (this.error != FD.EAGAIN)
@@ -419,13 +428,17 @@ function process_post(time)
 {
        var close = false;
        var len;
+       var data;
 
        if (this.post_data.length < this.http_content_length) {
                len = this.http_content_length - this.post_data.length;
                if (len > options.readbuf_size)
                        len = options.readbuf_size;
                try {
-                       this.post_data += this.read(len);
+                       data = this.read(len);
+                       if (data.length == 0)
+                               close = true;
+                       this.post_data += data;
                        this.updateTimeout(time);
                } catch (x) {
                        if (this.error != FD.EAGAIN)