-/* $Id: httpd.js,v 1.44 2006/11/24 00:53:54 mmondor Exp $ */
+/* $Id: httpd.js,v 1.45 2006/11/24 00:58:45 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.44 2006/11/24 00:53:54 mmondor Exp $';
+const SERVER_CVSID = '$Id: httpd.js,v 1.45 2006/11/24 00:58:45 mmondor Exp $';
for (i = 0; i < this.contents.length; i++)
contents += this.contents[i];
- /*
- 70.50.245.131 - - [23/Nov/2006:16:43:40 -0500] ascpi.net "POST
- /inscription/admin_recherche_do.php HTTP/1.0" 302 167 "-"
- "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.8)
- Gecko/20050511 Firefox/1.0.4"
- LogFormat "%h %l %u %t %v \"%r\" %>s %b \"%{Referer}i\"
- \"%{User-Agent}i\"" combined
- */
-
t = new Date();
Syslog.log(Syslog.LOG_NOTICE, fd.client_addr + ' - - ' +
http_log_date() + ' ' + fd.http_vhost.name + ' "' +
this.headers.push('Content-Length: ' +
(size == null ? contents.length : size));
- /* XXX
- stdout.write(' --> ' + this.code + ' ' +
- this.headers.toSource() + "\n");
- */
+ if (options.debug == true)
+ stdout.write(' --> ' + this.code + ' ' +
+ this.headers.toSource() + "\n");
headers += 'HTTP/1.1 ' + this.code + ' ' + this.desc + "\r\n";
for (i = 0; i < this.headers.length; i++)
headers += this.headers[i] + "\r\n";
/* Split request lines */
lines = this.query_data;
- /* XXX
- stdout.write(this.client_addr + ':' + this.client_port + ' ' +
- lines.toSource());
- */
+ if (options.debug == true)
+ stdout.write(this.client_addr + ':' + this.client_port + ' ' +
+ lines.toSource());
/* Verify if first line has a request which seems valid */
if (lines.length > 0) {
return PSTAT_CLOSE_SUCCESS;
}
- /* XXX In case of query to a directory done without the
- * trailing '/', apache redirects as follows:
- *
- * "HTTP/1.1 301 Moved Permanently\r
- * Date: Wed, 22 Nov 2006 04:01:03 GMT\r
- * Server: Apache/1.3.34 (Unix) mod_ssl/2.8.25 OpenSSL/0.9.7d\r
- * Location: http://mmondor.pulsar-zone.net/img_gallery/\r
- * Connection: close\r
- * Content-Type: text/html; charset=iso-8859-1\r
- * \r
- * <!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">
- * <HTML><HEAD>
- * <TITLE>301 Moved Permanently</TITLE>
- * </HEAD><BODY>
- * <H1>Moved Permanently</H1>
- * The document has moved <A
- * HREF=\"http://mmondor.pulsar-zone.net/img_ga\
- * llery/\">here</A>.<P>
- * </BODY></HTML>
- *
- * This however does not allow the client to know that the
- * current URL internally set to an index such as index.html.
- * Perhaps e should redirect to the full URL?
- * Except for directories without an index for which
- * auto-indexing is to be performed, of course.
- */
-
/* Directory? */
if ((st.st_mode & FD.S_IFDIR) != 0) {
var error = false;