2009-03-03 01:56:15 +01:00
|
|
|
function encode(data) {
|
|
|
|
var chunk = data.toString();
|
|
|
|
return chunk.length.toString(16) + "\r\n" + chunk + "\r\n";
|
|
|
|
}
|
|
|
|
|
2009-03-04 00:31:37 +01:00
|
|
|
var port = 8000;
|
2009-03-06 19:49:52 +01:00
|
|
|
var server = new HTTPServer("localhost", port);
|
2009-03-03 01:56:15 +01:00
|
|
|
|
2009-03-06 19:49:52 +01:00
|
|
|
server.onrequest = function (request) {
|
|
|
|
log("path: " + request.path);
|
|
|
|
log("query string: " + request.query_string);
|
2009-03-03 01:56:15 +01:00
|
|
|
|
2009-03-06 19:49:52 +01:00
|
|
|
request.respond("HTTP/1.1 200 OK\r\n");
|
|
|
|
request.respond("Content-Length: 0\r\n");
|
2009-03-03 01:56:15 +01:00
|
|
|
request.respond("\r\n");
|
2009-03-06 19:49:52 +01:00
|
|
|
request.respond(null);
|
2009-03-03 01:56:15 +01:00
|
|
|
};
|
2009-03-04 00:31:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
log("Running at http://localhost:" + port + "/");
|
|
|
|
|
|
|
|
|
2009-03-03 01:56:15 +01:00
|
|
|
/*
|
|
|
|
server.close();
|
|
|
|
*/
|