node-http-server
/src/handler.js |
@@ -133,14 +133,13 @@ |
return; |
} |
|
switch (stats.isDirectory()) { |
case true: // Directory is requested so provide directory indexes. |
if (stats.isDirectory()) { |
// Directory is requested so provide directory indexes. |
index(config, request, response, requestPath, requestURL, callback); |
break; |
default: // Browser requesting file. |
return; |
} |
// A file was requested so provide the file. |
files(config, request, response, requestPath, callback); |
break; |
} |
}); |
} |
|
@@ -193,10 +192,9 @@ |
return; |
} |
|
// Check if the requested path requires authentication. |
switch (config.auth.locations.some( |
// If authentication is required for this path then perform authentication. |
if (config.auth.locations.some( |
(authPath) => authPath.toUpperCase() === requestURL.pathname.toUpperCase())) { |
case true: |
// Requested location requires authentication. |
authentication.check(request, response, (request, response) => { |
process.nextTick(() => { |
@@ -216,8 +214,10 @@ |
callback |
); |
}); |
break; |
default: |
return; |
} |
|
// If no authentication is required then serve the request. |
process.nextTick(() => { |
callback('Client: ' + |
requestAddress.address + ':' + |
@@ -234,8 +234,6 @@ |
requestURL.pathname, |
callback |
); |
break; |
} |
}); |
}); |
} |