node-http-server

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 31  →  ?path2? @ 32
/src/handler.js
@@ -248,7 +248,7 @@
var self = this;
 
// Get client details.
const requestAddress = request.socket.address();
const address = request.socket.address();
// Get requested URL.
const requestURL = url.parse(
request.url, true
@@ -296,13 +296,13 @@
if (error) {
self.emit('log', {
message: 'Unknown path requested: ' +
requestAddress.address + ':' +
requestAddress.port +
address.address + ':' +
address.port +
' requesting: ' +
requestURL.pathname,
severity: 'warning'
});
self.emit('done', {
self.emit('data', {
status: 404,
data: new stream.Readable({
read(size) {
@@ -313,6 +313,7 @@
});
return;
}
// Check for path traversals early on and bail if the requested path does not
// lie within the specified document root.
isRooted(resolvedPath, root, path.sep, (rooted) => {
@@ -319,8 +320,8 @@
if (!rooted) {
self.emit('log', {
message: 'Attempted path traversal: ' +
requestAddress.address + ':' +
requestAddress.port +
address.address + ':' +
address.port +
' requesting: ' +
requestURL.pathname,
severity: 'warning'
@@ -352,8 +353,8 @@
authentication.check(request, response, (request, response) => {
self.emit('log', {
message: 'Authenticated client: ' +
requestAddress.address + ':' +
requestAddress.port +
address.address + ':' +
address.port +
' accessing: ' +
requestURL.pathname,
severity: 'info'
@@ -363,7 +364,7 @@
config,
requestPath,
requestURL.pathname,
requestAddress
address
)
);
});
@@ -373,8 +374,8 @@
// If no authentication is required then serve the request.
self.emit('log', {
message: 'Client: ' +
requestAddress.address + ':' +
requestAddress.port +
address.address + ':' +
address.port +
' accessing: ' +
requestURL.pathname,
severity: 'info'
@@ -384,7 +385,7 @@
config,
requestPath,
requestURL.pathname,
requestAddress
address
)
);
});