-/* $Id: httpd.js,v 1.71 2005/07/31 04:51:50 mmondor Exp $ */
+/* $Id: httpd.js,v 1.72 2005/08/08 15:11:29 mmondor Exp $ */
/*
* Copyright (c) 2005, Matthew Mondor
* Server identification
*/
SERVER_VERSION = 'mmondor_js_httpd/0.0.1 (NetBSD)';
-SERVER_CVSID = '$Id: httpd.js,v 1.71 2005/07/31 04:51:50 mmondor Exp $';
+SERVER_CVSID = '$Id: httpd.js,v 1.72 2005/08/08 15:11:29 mmondor Exp $';
headers += 'Content-Type: ' + this.type + "\r\n";
headers += "\r\n";
- if (!fd.http_old_get)
- fd.bwrite(headers + contents);
- else
- fd.bwrite(contents);
+ try {
+ if (!fd.http_old_get)
+ fd.bwrite(headers + contents);
+ else
+ fd.bwrite(contents);
+ } catch (x) {}
}
}
return close;
}
+/*
+ * After reading post data, allows to parse it down into variables
+ */
FD.prototype.parsePost = function(time)
{
var words;
return this.httpRespond(time);
}
+/*
+ * Finally respond to client request
+ */
FD.prototype.httpRespond = function(time)
{
var path, fd, st, res, ext, mimetype, i, sess, size;
* instead of write(2). The main poll(2) based loop can then handle buffer
* flushing. However, we first attempt to immediately write as much as we can
* before queuing what needs to be written again.
+ * Like write(2), this function can throw an exception on error, including
+ * for EAGAIN.
*/
FD.prototype.bwrite = function(data)
{