-/* $Id: httpd.js,v 1.30 2006/08/19 11:41:57 mmondor Exp $ */
+/* $Id: httpd.js,v 1.31 2006/08/19 11:43:12 mmondor Exp $ */
/*
* Copyright (c) 2005-2006, Matthew Mondor
* Server identification
*/
const SERVER_VERSION = 'mmondor_js_httpd/0.1.0 (NetBSD)';
-const SERVER_CVSID = '$Id: httpd.js,v 1.30 2006/08/19 11:41:57 mmondor Exp $';
+const SERVER_CVSID = '$Id: httpd.js,v 1.31 2006/08/19 11:43:12 mmondor Exp $';
FD.prototype.state_http_init = function(time)
{
/* For differenciation after poll(2) */
- this.stype = STYPE_HTTP;
+ this.type = STYPE_HTTP;
this.stat = PSTAT_CONTINUE;
/* Empty request */
*/
try {
fd = new FD();
- fd.stype = STYPE_CONNECT;
+ fd.type = STYPE_CONNECT;
fd.fcntl(FD.F_SETFL, FD.O_NONBLOCK);
fd.connect(s.host, s.port);
}
/* Success */
- this.stype = STYPE_APPSERV;
+ this.type = STYPE_APPSERV;
this.client_fd = undefined;
this.transfer_state = TSTATE_WRITE;
/* XXX */
* polling set
*/
fd.events = FD.POLLIN;
- fd.stype = STYPE_LISTEN;
+ fd.type = STYPE_LISTEN;
poll_set_add(fd);
} catch (x) {
err.put(x + " preparing listening socket\n");
for (i in poll_set) {
if ((fd = poll_set[i]) == undefined ||
- fd.stype != STYPE_HTTP)
+ fd.type != STYPE_HTTP)
continue;
if (fd.expires <= cur) {
/*
* If descriptor is a bound one, attempt to accept
* the new client connection
*/
- if (efd.stype == STYPE_LISTEN &&
+ if (efd.type == STYPE_LISTEN &&
(efd.revents & FD.POLLIN) != 0) {
try {
fd = efd.accept();
try {
efd.close();
} catch (x) {}
- if (efd.stype == STYPE_APPSERV) {
+ if (efd.type == STYPE_APPSERV) {
/* Dismiss SID->FD table entry */
sid_table[efd.sid] = undefined;
/* appserv object back to pool */