-/* $Id: httpd.js,v 1.36 2006/08/20 20:32:42 mmondor Exp $ */
+/* $Id: httpd.js,v 1.37 2006/08/22 10:12:54 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.36 2006/08/20 20:32:42 mmondor Exp $';
+const SERVER_CVSID = '$Id: httpd.js,v 1.37 2006/08/22 10:12:54 mmondor Exp $';
this.transfer_state = TSTATE_WRITE;
} catch (x) {
stat = PSTAT_CLOSE_ERROR;
- try {
- this.transfer_src.close();
- } catch (x) {}
}
}
if (this.transfer_state == TSTATE_WRITE) {
} else if (this.berror != this.BEAGAIN)
stat = PSTAT_CLOSE_ERROR;
}
- if (stat != PSTAT_CONTINUE) {
- try {
- this.transfer_src.close();
- } catch (x) {}
- }
}
+ /* Currently redundant unless we supported Keep-Alive
+ if (stat != PSTAT_CONTINUE) {
+ try {
+ this.transfer_src.close();
+ } catch (x) {}
+ }
+ */
+
return stat;
}
/*
* Fill in associative array with any GET-style supplied
* variables (as part of the URL). We want this even for POST method.
+ * XXX We might need to account for vars without content, and for %xx
+ * characters...
*/
if ((i = this.http_path.lastIndexOf('?')) != -1) {
var v;
* 2) If file successfully opened, upload it to client.
* 3) If to forward request to appserver, perform the following:
*
+ * XXX Rewrite this
* 1) Verify if session cookie provided. If not, invoke appserver
* to create a new session and send new session cookie to client,
* redirecting it to the same path after a few seconds. Record
if (appserv_match) {
http_error(this, 500, 'Internal Server Error',
'You have requested an application server handled path ' +
- 'which cannot be handled at this time. Please try ' +
+ 'which cannot be processed at this time. Please try ' +
'again later.');
return PSTAT_CLOSE_SUCCESS;
}
* takes place.
* Hence we seem to need some general purpose FD based
* semaphore system...
+ * XXX Let's resume this... we need states:
+ * WAIT_CONNECTION (per-sid, must also have create/load
+ * command and if create, be able to return to client the
+ * new SID)
+ * WAIT_SID (per-client)
+ * TRANSFER_SID (one client at a time)
*/
http_error(this.client_fd, 500, 'Internal Server Error',
'There was an error establishing connection to an ' +
* them to return a 500 error
*/
}
+ /*
+ * If there were any static file uploads in
+ * progress, close source file's descriptor
+ */
+ if (efd.transfer_src != undefined) {
+ try {
+ efd.transfer_src.close();
+ } catch (x) {}
+ }
climits.remove(efd);
pollset.remove(efd);
}