mailserver: typo where port was not used
This commit is contained in:
@@ -32,23 +32,23 @@ async function proxyToMailContainer(port, pathname, req, res, next) {
|
||||
|
||||
const opts = {
|
||||
hostname: addonDetails.ip,
|
||||
port: 3000,
|
||||
port,
|
||||
path: `/${pathname}?${searchParams.toString()}`,
|
||||
method: req.method,
|
||||
headers: req.headers
|
||||
};
|
||||
|
||||
const sftpReq = http.request(opts, function (sftpRes) {
|
||||
res.writeHead(sftpRes.statusCode, sftpRes.headers);
|
||||
sftpRes.on('error', (error) => next(new HttpError(500, `mailserver error: ${error.message} ${error.code}`)));
|
||||
sftpRes.on('end', () => next());
|
||||
sftpRes.pipe(res);
|
||||
const mailReq = http.request(opts, function (mailRes) {
|
||||
res.writeHead(mailRes.statusCode, mailRes.headers);
|
||||
mailRes.on('error', (error) => next(new HttpError(500, `mailserver error: ${error.message} ${error.code}`)));
|
||||
mailRes.on('end', () => next());
|
||||
mailRes.pipe(res);
|
||||
});
|
||||
sftpReq.on('error', (error) => next(new HttpError(424, `Unable to connect to mailserver: ${error.message} ${error.code}`)));
|
||||
mailReq.on('error', (error) => next(new HttpError(424, `Unable to connect to mailserver: ${error.message} ${error.code}`)));
|
||||
if (!req.readable) {
|
||||
sftpReq.end();
|
||||
mailReq.end();
|
||||
} else {
|
||||
req.pipe(sftpReq);
|
||||
req.pipe(mailReq);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user