node-http-server

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 29  →  ?path2? @ 30
/server.js
@@ -94,24 +94,22 @@
http.createServer(
// authentication,
(request, response) =>
handler.process(config, request, response, root, (result) => {
handler.process(config, request, response, root, (logging, result) => {
 
// Log the message by severity.
log.log(result.severity, result.message);
if(result.status)
response.status = result.status;
// If no data stream is made available or the content type is not
// set then there is no further reason to bother with the request.
if(typeof result.data === 'undefined' || result.data === null ||
typeof result.type === 'undefined' || result.type === null)
log.log(logging.severity, logging.message);
 
// If no result is to be processed, then terminate the request.
if (typeof result === 'undefined' || result === null)
return;
 
// Set the response status.
response.status = result.status;
// Set the content type and send the data.
response.setHeader('Content-Type', result.type);
result.data
.on('open', () => result.data.pipe(response));
.on('readable', () => result.data.pipe(response))
.on('end', () => response.end());
})
).listen(config.net.port, config.net.address, () => {
log.info('HTTP Server accessible at: http://' +
@@ -140,20 +138,19 @@
(request, response) =>
handler.process(config, request, response, root, (result) => {
// Log the message by severity.
log.log(result.severity, result.message);
if(result.status)
response.status = result.status;
// If no data stream is made available or the content type is not
// set then there is no further reason to bother with the request.
if(typeof result.data === 'undefined' || result.data === null ||
typeof result.type === 'undefined' || result.type === null)
log.log(logging.severity, logging.message);
 
// If no result is to be processed, then terminate the request.
if (typeof result === 'undefined' || result === null)
return;
 
// Set the response status.
response.status = result.status;
// Set the content type and send the data.
response.setHeader('Content-Type', result.type);
result.data
.on('open', () => result.data.pipe(response));
.on('readable', () => result.data.pipe(response))
.on('end', () => response.end());
})
).listen(config.ssl.port, config.ssl.address, () => {
log.info('HTTPs Server accessible at: https://' +