*** empty log message ***
authorMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 22 Aug 2006 13:51:58 +0000 (13:51 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Tue, 22 Aug 2006 13:51:58 +0000 (13:51 +0000)
mmsoftware/js/js-sh/app/httpd/httpd.js
mmsoftware/js/js-sh/app/httpd/options.js
mmsoftware/js/jslib/fd.js

index 7489b0e..604e87c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: httpd.js,v 1.38 2006/08/22 12:50:07 mmondor Exp $ */
+/* $Id: httpd.js,v 1.39 2006/08/22 13:51:58 mmondor Exp $ */
 
 /*
  * Copyright (c) 2005-2006, Matthew Mondor
@@ -76,7 +76,7 @@
  * Server identification
  */
 const SERVER_VERSION = 'mmondor_js_httpd/0.1.0 (NetBSD)';
-const SERVER_CVSID = '$Id: httpd.js,v 1.38 2006/08/22 12:50:07 mmondor Exp $';
+const SERVER_CVSID = '$Id: httpd.js,v 1.39 2006/08/22 13:51:58 mmondor Exp $';
 
 
 
@@ -683,6 +683,12 @@ function state_http_transfer_file(time)
                if (this.transfer_eof)
                        stat = PSTAT_CLOSE_SUCCESS;
                else {
+                       /*
+                        * XXX For some reason, we now get problems with
+                        * immediate writing mode.  Dandling client and file
+                        * descriptors remain, like if HUP was ignored for
+                        * some reason.
+                        */
                        if (this.bwrite(this.transfer_data, false, false)
                            != -1) {
                                this.transfer_state = TSTATE_READ;
@@ -1915,7 +1921,10 @@ function main() {
                         * events, which will tell when we should drop the
                         * client.
                         */
-                       if ((efd.revents & (FD.POLLHUP | FD.POLLERR)) != 0)
+                       if ((efd.revents & (FD.POLLHUP | FD.POLLERR)) != 0 ||
+                           /* XXX poll(2) says POLLOUT | POLLHUP impossible */
+                           ((efd.events & FD.POLLOUT) == 1 &&
+                           (efd.revents & FD.POLLIN) == 1))
                                efd.stat = PSTAT_CLOSE_ERROR;
                        else if (efd.stat != PSTAT_CLOSE_ERROR &&
                            (efd.revents & (FD.POLLIN | FD.POLLOUT)) != 0) {
index e1ff89e..be425f5 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: options.js,v 1.24 2006/08/20 20:32:42 mmondor Exp $ */
+/* $Id: options.js,v 1.25 2006/08/22 13:51:58 mmondor Exp $ */
 
 var ilibprefix = "/home/mmondor/work/mmondor/mmsoftware/js/jslib/";
 
@@ -10,7 +10,7 @@ var options = {
        max_query_size:         4096,
        max_post_size:          65536,
        io_timeout:             60,
-       file_buf_size:          65536,
+       file_buf_size:          65535,
        default_vhost:          "appserv.pulsar-zone.net",
        default_mimetype:       "application/octet-stream",
        default_charset:        "us-ascii",
index 711ed75..b75e69e 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: fd.js,v 1.9 2006/08/22 12:49:57 mmondor Exp $ */
+/* $Id: fd.js,v 1.10 2006/08/22 13:47:18 mmondor Exp $ */
 
 /*
  * Copyright (C) 2006, Matthew Mondor
@@ -184,17 +184,17 @@ FD.prototype.bwrite = function(data, immediate, poll)
                }
                if (len == data.length)
                        return 0;
+
                this.bwrite_buffer += data.substr(len);
-               this.events |= FD.POLLOUT;
-               return 1;
-       } else {
-               this.events |= FD.POLLOUT;
+               /* FALLTHROUGH */
+       } else
                this.bwrite_buffer += data;
-               if (this.bwrite_buffer.length > 65535)
-                       return this.bflushw(poll);
-       }
 
-       return 0;
+       this.events |= FD.POLLOUT;
+       if (this.bwrite_buffer.length > 65534)
+               return this.bflushw(poll);
+
+       return 1;
 }
 
 /*