-/* $Id: httpd.js,v 1.49 2007/01/07 11:27:54 mmondor Exp $ */
+/* $Id: httpd.js,v 1.50 2007/01/17 16:43:47 mmondor Exp $ */
/*
* Copyright (c) 2005-2006, Matthew Mondor
* Server identification
*/
const SERVER_VERSION = 'mmondor_js_httpd/0.2.1 (NetBSD)';
-const SERVER_CVSID = '$Id: httpd.js,v 1.49 2007/01/07 11:27:54 mmondor Exp $';
+const SERVER_CVSID = '$Id: httpd.js,v 1.50 2007/01/17 16:43:47 mmondor Exp $';
}
if (s == undefined)
- stderr.write("No more free appserv slots\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ "* No more free appserv slots");
return s;
},
if (data == null) {
/* Error */
if (this.berror != this.BEAGAIN) {
- /* XXX */ stderr.write(this.berrorStr[this.berror]
- + "\n");
+ /* XXX */ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + this.berrorStr[this.berror]);
if (this.berror == this.BTOOLONG)
http_error(this, 413,
'Request Entity Too Large',
len = this.http_content_length - this.post_data.length;
if ((data = this.bread(len, false)) == null) {
if (this.berror != this.BEAGAIN) {
- /* XXX */ stderr.write(
- this.berrorStr[this.berror] + "\n");
+ /* XXX */ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + this.berrorStr[this.berror]);
return PSTAT_CLOSE_ERROR;
}
}
try {
fd.lseek(from, FD.SEEK_SET);
} catch(x) {
- stderr.write(x +
- " at lseek()\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + x + ' at lseek()');
}
}
}
pollset.add(fd);
} catch (x) {
- stderr.write(x + " in appserv_connect()\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + x + ' in appserv_connect()');
return false;
}
try {
var v = new VHost(vhosts[i]);
} catch (x) {
- stderr.write(x + " creating VHost object\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + x + ' creating VHost object');
}
}
/*
* Attempt to link default_vhost to a VHost object
*/
if (options.default_vhost == undefined) {
- stderr.write("No default_vhost property in options, exiting\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* No default_vhost property in options, exiting');
exit();
}
if (vhosts_table[options.default_vhost.toLowerCase()] != undefined)
default_vhost =
vhosts_table[options.default_vhost.toLowerCase()];
else {
- stderr.write('Default vhost ' + options.default_vhost +
- " unkonwn, exiting\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* Default vhost ' + options.default_vhost +
+ ' unknown, exiting');
exit();
}
for (i2 in mimetypes[i]) {
ext = mimetypes[i][i2].toLowerCase();
if (mimetypes_table[ext] != undefined) {
- stderr.write('Conflicting mime type ' +
- ext + ' -> ' + i + "\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* Conflicting mime type ' + ext +
+ ' -> ' + i);
continue;
}
mimetypes_table[ext] = i;
fd.type = STYPE_LISTEN;
pollset.add(fd);
} catch (x) {
- stderr.write(x + " preparing listening socket\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + x + ' preparing listening socket');
}
}
if (pollset.count == 0)
try {
e = FD.poll(pollset.set, exp * 1000);
} catch (x) {
- stderr.write(x + " for poll(2)\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + x + ' for poll(2)');
continue;
}
fd.state_http_init(cur);
pollset.add(fd);
} catch (x) {
- stderr.write(x +
- " at accept(2)\n");
+ Syslog.log(Syslog.LOG_NOTICE,
+ '* ' + x +
+ ' at accept(2)');
fd.close();
}
}