Exit if REQUEST_METHOD is wrong.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8a0b8055c6
commit
1407954ab9
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Reference in New Issue
Block a user