Skip to content

Commit 4dd6bde

Browse files
thisIsTheFoxeHenrik Storch
authored andcommitted
resolve conflicts coming from PR #586; (small optimizations)
1 parent 07a79ed commit 4dd6bde

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lib/http-server.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,21 @@ function HttpServer(options) {
6868

6969
var before = options.before ? options.before.slice() : [];
7070

71-
before.push(function (req, res) {
72-
if (options.httpsPort) {
71+
if (options.httpsPort) {
72+
before.push(function (req, res) {
7373
var hostname = req.headers.host.match(/:/g) ? req.headers.host.slice(0, req.headers.host.indexOf(':')) : req.headers.host;
7474
var httpsUrl = 'https://' + hostname + ':' + options.httpsPort + req.url;
7575
res.writeHead(301, { Location: httpsUrl });
7676
res.end();
77+
});
78+
}
7779

78-
if (options.logFn) {
79-
options.logFn(req, res);
80-
}
81-
return;
82-
}
83-
84-
if (options.logFn) {
80+
if (options.logFn) {
81+
before.push(function (req, res) {
8582
options.logFn(req, res);
8683
res.emit('next');
87-
}
88-
});
84+
});
85+
}
8986

9087
if (options.username || options.password) {
9188
before.push(function (req, res) {

0 commit comments

Comments
 (0)