Exit if REQUEST_METHOD is wrong.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
tastytea 2020-11-15 17:46:17 +01:00
parent 8a0b8055c6
commit 1407954ab9
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 16 additions and 1 deletions

View File

@ -191,8 +191,16 @@ int main(int /*argc*/, char * /*argv*/[])
using std::cerr;
using std::cout;
using std::exception;
using std::getenv;
using std::runtime_error;
cout << "Content-Type: application/rss+xml\r\n\r\n";
char *env{getenv("REQUEST_METHOD")};
if (env != nullptr && string(env) != "GET")
{
return 0;
}
git::init(true);
@ -209,7 +217,6 @@ int main(int /*argc*/, char * /*argv*/[])
// Ignore, use old version of repo.
}
const auto entries{files::read_json_files(true)};
cout << "Content-Type: application/rss+xml\r\n\r\n";
write_rss(cout, entries, cgi::get_tags());
}
catch (const exception &e)

View File

@ -25,12 +25,14 @@
#include <git2/global.h>
#include <cstdlib>
#include <exception>
#include <iostream>
using std::cerr;
using std::cout;
using std::exception;
using std::getenv;
using namespace FediBlock;
@ -38,6 +40,12 @@ int main()
{
cout << "Content-Type: text/plain; charset=utf-8\r\n\r\n";
char *env{getenv("REQUEST_METHOD")};
if (env != nullptr && string(env) != "POST")
{
return 0;
}
git::init(true);
gitea::init();