node-http-server – Diff between revs 19 and 20

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 19 Rev 20
Line 136... Line 136...
136 if (stats.isDirectory()) { 136 if (stats.isDirectory()) {
137 // Directory is requested so provide directory indexes. 137 // Directory is requested so provide directory indexes.
138 index(config, request, response, requestPath, requestURL, callback); 138 index(config, request, response, requestPath, requestURL, callback);
139 return; 139 return;
140 } 140 }
-   141 if (stats.isFile()) {
-   142 const file = path.parse(requestPath).base;
-   143 if (config.site.refuse.some((expression) => expression.test(file)) ||
-   144 !config.site.accept.some((expression) => expression.test(file))) {
-   145 response.statusCode = 404;
-   146 response.end();
-   147 return;
-   148 }
-   149  
141 // A file was requested so provide the file. 150 // A file was requested so provide the file.
142 files(config, request, response, requestPath, callback); 151 files(config, request, response, requestPath, callback);
-   152 }
143 }); 153 });
144 } 154 }
Line 145... Line 155...
145   155  
146 module.exports = { 156 module.exports = {
Line 151... Line 161...
151 ERROR: 3 161 ERROR: 3
152 } 162 }
153 }, 163 },
154 process: (config, request, response, root, callback) => { 164 process: (config, request, response, root, callback) => {
155 process.nextTick(() => { 165 process.nextTick(() => {
156 // Create digest authentication. -  
157 const authentication = auth.digest({ -  
158 realm: config.auth.realm, -  
159 file: path.resolve( -  
160 path.dirname(require.main.filename), -  
161 config.auth.digest -  
162 ) -  
163 }); -  
164   -  
165 const requestAddress = request.socket.address(); 166 const requestAddress = request.socket.address();
166 const requestURL = url.parse( 167 const requestURL = url.parse(
167 request.url, true 168 request.url, true
168 ); 169 );
Line 193... Line 194...
193 } 194 }
Line 194... Line 195...
194   195  
195 // If authentication is required for this path then perform authentication. 196 // If authentication is required for this path then perform authentication.
196 if (config.auth.locations.some( 197 if (config.auth.locations.some(
-   198 (authPath) => authPath.toUpperCase() === requestURL.pathname.toUpperCase())) {
-   199 // Create digest authentication.
-   200 const authentication = auth.digest({
-   201 realm: config.auth.realm,
-   202 file: path.resolve(
-   203 path.dirname(require.main.filename),
-   204 config.auth.digest
-   205 )
197 (authPath) => authPath.toUpperCase() === requestURL.pathname.toUpperCase())) { 206 });
198 // Requested location requires authentication. 207 // Requested location requires authentication.
199 authentication.check(request, response, (request, response) => { 208 authentication.check(request, response, (request, response) => {
200 process.nextTick(() => { 209 process.nextTick(() => {
201 callback('Authenticated client: ' + 210 callback('Authenticated client: ' +