mirror of
https://github.com/azures04/crafatar.git
synced 2026-03-21 23:41:18 +01:00
allow only GET + HEAD requests
This commit is contained in:
parent
846b738226
commit
0a4011abc1
@ -48,7 +48,7 @@ function requestHandler(req, res) {
|
||||
|
||||
var local_path = request.url.pathname.split("/")[1];
|
||||
console.log(request.method + " " + request.url.pathname);
|
||||
|
||||
if (request.method == "GET" || request.method == "HEAD") {
|
||||
try {
|
||||
switch (local_path) {
|
||||
case "":
|
||||
@ -74,6 +74,12 @@ function requestHandler(req, res) {
|
||||
});
|
||||
res.end(config.debug_enabled ? error : "Internal server error");
|
||||
}
|
||||
} else {
|
||||
res.writeHead(405, {
|
||||
"Content-Type": "text/plain"
|
||||
});
|
||||
res.end("Method not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
http.createServer(requestHandler).listen(process.env.PORT || 3000);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user