Switch to fcgi_stdio

FossilOrigin-Name: 4c4dbf4b391b2e37376de65f75cb05404950d52339b10f6619e413979c681b9c
This commit is contained in:
me@ow.nekobit.net 2022-03-21 14:18:56 +00:00
parent 1c42d9feee
commit 3bfedc3d32
11 changed files with 16 additions and 15 deletions

View file

@ -17,7 +17,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "base_page.h"
#include "../config.h"
#include "account.h"

View file

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <fcgi_stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "base_page.h"
#include "easprintf.h"

View file

@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <fcgi_stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "cookie.h"
#include "key.h"
@ -44,7 +44,7 @@ char* read_cookies_env()
char* cookies_str = malloc(strlen(cookies_env));
if (!cookies_str)
{
perror("malloc");
printf("malloc");
return NULL;
}
strcpy(cookies_str, cookies_env);

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <fcgi_stdio.h>
#include <stdlib.h>
#include "easprintf.h"

View file

@ -17,7 +17,6 @@
*/
#include <stdlib.h>
#include <stdio.h>
#include "base_page.h"
#include "../config.h"
#include "account.h"

View file

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <fcgi_stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "query.h"
#include "base_page.h"
#include "login.h"

View file

@ -16,9 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <string.h>
#include <fcgi_stdio.h>
#include <string.h>
#include <mastodont.h>
#include <stdlib.h>
#include "../config.h"
@ -41,8 +40,10 @@ int main(void)
// Global init
mastodont_global_curl_init();
unsigned run_count = 0;
// API
while (FCGI_Accept() >= 0)
for (;FCGI_Accept() >= 0; ++run_count)
{
mastodont_t api;
api.url = config_instance_url;
@ -74,6 +75,8 @@ int main(void)
{ "/notifications", content_notifications },
};
printf("Run: %d\r\n", run_count);
handle_paths(&api, paths, sizeof(paths)/sizeof(paths[0]));
// Cleanup
@ -82,8 +85,9 @@ int main(void)
mastodont_free(&api);
// Obliterate all global values, so the next client
// can't even consider reading them
// can't even think reading them
memset(&cookies, 0, sizeof(cookies));
memset(&post, 0, sizeof(post));
}
mastodont_global_curl_cleanup();

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <fcgi_stdio.h>
#include <stdlib.h>
#include <string.h>
#include "base_page.h"

View file

@ -16,9 +16,9 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <fcgi_stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include "query.h"
#include "key.h"

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <fcgi_stdio.h>
#include <string.h>
#include <stdlib.h>
#include "string_helpers.h"

View file

@ -18,7 +18,6 @@
#include "timeline.h"
#include <stdlib.h>
#include <stdio.h>
#include "base_page.h"
#include "../config.h"
#include "index.h"