You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
749 B

function Process(request) {
//
// request.headers => { "Content-Length": "123" }
// request.http_version => "1.1"
//
log("Processing " + request.path + ". method: " + request.method);
// sends null on the last chunk.
request.onBody = function (chunk) {
log("got chunk length: " + chunk.length.toString(16) );
if(chunk) {
this.respond(chunk.length.toString(16) + "\r\n" + chunk + "\r\n");
} else {
this.respond("0\r\n\r\n");
this.respond(null);
}
}
request.respond("HTTP/1.0 200 OK\r\n");
request.respond("Content-Type: text-plain\r\n");
request.respond("Transfer-Encoding: chunked\r\n");
request.respond("\r\n");
//request.respond("Content-Length: 6\r\n\r\nhello\n");
//
}