mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 06:28:40 +01:00
26 lines
525 B
JavaScript
26 lines
525 B
JavaScript
function encode(data) {
|
|
var chunk = data.toString();
|
|
return chunk.length.toString(16) + "\r\n" + chunk + "\r\n";
|
|
}
|
|
|
|
var port = 8000;
|
|
var server = new HTTPServer("localhost", port);
|
|
|
|
server.onrequest = function (request) {
|
|
log("path: " + request.path);
|
|
log("query string: " + request.query_string);
|
|
|
|
request.respond("HTTP/1.1 200 OK\r\n");
|
|
request.respond("Content-Length: 0\r\n");
|
|
request.respond("\r\n");
|
|
request.respond(null);
|
|
};
|
|
|
|
|
|
log("Running at http://localhost:" + port + "/");
|
|
|
|
|
|
/*
|
|
server.close();
|
|
*/
|