aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Rincón Blanco <ruben@rinconblanco.es>2022-08-25 21:51:10 +0200
committerGitHub <noreply@github.com>2022-08-25 21:51:10 +0200
commit16dca9d307220229b80327ea0998c4cecec9137b (patch)
tree0a0b5b687f1bc67316afcf0e66a0ca569d727db7
parent105b814acfc3f8b0286d0f59f3204be3dec3f9d3 (diff)
downloadcompiler-explorer-gh-4022.tar.gz
compiler-explorer-gh-4022.zip
Bring back old behaviour of 404 on missing compiler (#3981)gh-4022
-rw-r--r--lib/handlers/api.js9
-rw-r--r--lib/handlers/compile.js17
2 files changed, 12 insertions, 14 deletions
diff --git a/lib/handlers/api.js b/lib/handlers/api.js
index c355cb06f..0301aa806 100644
--- a/lib/handlers/api.js
+++ b/lib/handlers/api.js
@@ -91,18 +91,11 @@ export class ApiHandler {
this.handle
.route('/popularArguments/:compiler')
.post(compileHandler.handlePopularArguments.bind(compileHandler))
- .all(methodNotAllowed);
- this.handle
- .route('/optimizationArguments/:compiler')
- .post(compileHandler.handleOptimizationArguments.bind(compileHandler))
- .all(methodNotAllowed);
-
- this.handle
- .route('/popularArguments/:compiler')
.get(compileHandler.handlePopularArguments.bind(compileHandler))
.all(methodNotAllowed);
this.handle
.route('/optimizationArguments/:compiler')
+ .post(compileHandler.handleOptimizationArguments.bind(compileHandler))
.get(compileHandler.handleOptimizationArguments.bind(compileHandler))
.all(methodNotAllowed);
diff --git a/lib/handlers/compile.js b/lib/handlers/compile.js
index e9b7a0e8c..87632dca6 100644
--- a/lib/handlers/compile.js
+++ b/lib/handlers/compile.js
@@ -338,15 +338,19 @@ export class CompileHandler {
return {source, options, backendOptions, filters, bypassCache, tools, executionParameters, libraries};
}
- handlePopularArguments(req, res, next) {
+ handlePopularArguments(req, res) {
const compiler = this.compilerFor(req);
- if (!compiler) return next();
+ if (!compiler) {
+ return res.sendStatus(404);
+ }
res.send(compiler.possibleArguments.getPopularArguments(this.getUsedOptions(req)));
}
- handleOptimizationArguments(req, res, next) {
+ handleOptimizationArguments(req, res) {
const compiler = this.compilerFor(req);
- if (!compiler) return next();
+ if (!compiler) {
+ return res.sendStatus(404);
+ }
res.send(compiler.possibleArguments.getOptimizationArguments(this.getUsedOptions(req)));
}
@@ -377,7 +381,7 @@ export class CompileHandler {
handleCmake(req, res, next) {
const compiler = this.compilerFor(req);
if (!compiler) {
- return next();
+ return res.sendStatus(404);
}
const remote = compiler.getRemote();
@@ -413,8 +417,9 @@ export class CompileHandler {
handle(req, res, next) {
const compiler = this.compilerFor(req);
if (!compiler) {
- return next();
+ return res.sendStatus(404);
}
+
const remote = compiler.getRemote();
if (remote) {
req.url = remote.path;