Exit if REQUEST_METHOD is wrong.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
8a0b8055c6
commit
1407954ab9
|
@ -191,8 +191,16 @@ int main(int /*argc*/, char * /*argv*/[])
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::exception;
|
using std::exception;
|
||||||
|
using std::getenv;
|
||||||
using std::runtime_error;
|
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);
|
git::init(true);
|
||||||
|
|
||||||
|
@ -209,7 +217,6 @@ int main(int /*argc*/, char * /*argv*/[])
|
||||||
// Ignore, use old version of repo.
|
// Ignore, use old version of repo.
|
||||||
}
|
}
|
||||||
const auto entries{files::read_json_files(true)};
|
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());
|
write_rss(cout, entries, cgi::get_tags());
|
||||||
}
|
}
|
||||||
catch (const exception &e)
|
catch (const exception &e)
|
||||||
|
|
|
@ -25,12 +25,14 @@
|
||||||
|
|
||||||
#include <git2/global.h>
|
#include <git2/global.h>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using std::cerr;
|
using std::cerr;
|
||||||
using std::cout;
|
using std::cout;
|
||||||
using std::exception;
|
using std::exception;
|
||||||
|
using std::getenv;
|
||||||
|
|
||||||
using namespace FediBlock;
|
using namespace FediBlock;
|
||||||
|
|
||||||
|
@ -38,6 +40,12 @@ int main()
|
||||||
{
|
{
|
||||||
cout << "Content-Type: text/plain; charset=utf-8\r\n\r\n";
|
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);
|
git::init(true);
|
||||||
gitea::init();
|
gitea::init();
|
||||||
|
|
||||||
|
|
Reference in New Issue