node/count-hosts.js

13 lines
376 B
JavaScript
Raw Normal View History

2009-02-21 00:06:07 +08:00
function Process(request) {
2009-02-22 04:00:40 +08:00
log("Processing " + request.path + ". method: " + request.method);
2009-02-23 01:15:18 +08:00
// sends null on the last chunk.
2009-02-22 04:00:40 +08:00
request.onBody = function (chunk) {
2009-02-23 01:15:18 +08:00
log("body chunk: '" + chunk + "'");
2009-02-21 00:06:07 +08:00
}
2009-02-23 01:15:18 +08:00
2009-02-23 00:46:11 +08:00
request.respond("HTTP/1.0 200 OK\r\n")
request.respond("Content-Type: text-plain\r\nContent-Length: 6\r\n\r\nhello\n");
2009-02-23 01:15:18 +08:00
request.respond(null); // eof
2009-02-21 00:06:07 +08:00
}