SSL flags

FossilOrigin-Name: 744da72a961bbb51926dae5dd1fb1369d95dae876c34ac5e311d2a7d7ec82b6c
This commit is contained in:
me@ow.nekobit.net 2022-03-28 18:38:10 +00:00
parent 6175b49a68
commit df2b914728
4 changed files with 66 additions and 5 deletions

View file

@ -25,11 +25,8 @@
typedef unsigned char mstdnt_bool;
#define MSTDNT_FLAG_NO_URI_SANITIZE (1<<0)
#define MSTDNT_FLAG_SSL_NONE (1<<1)
#define MSTDNT_FLAG_SSL_UNVERIFIED (1<<2)
#define MSTDNT_FLAG_SSL_EXPIRED (1<<3)
#define MSTDNT_FLAG_SSL_SELFSIGNED (1<<4)
#define MSTDN_FLAG_ISSET(flags, flag) (((flags) & (flag)) == (flag))
#define MSTDNT_FLAG_ISSET(flags, flag) (((flags) & (flag)) == (flag))
#define MSTDNT_T_FLAG_ISSET(flag_ref, flag) (((flag_ref->flags) & (flag)) == (flag))
typedef struct mastodont

View file

@ -43,7 +43,6 @@ void mastodont_fetch_results_cleanup(struct mstdnt_fetch_results* res)
free(res->response);
}
#include <stdio.h>
#define TOKEN_STR_SIZE 512
int mastodont_fetch_curl(mastodont_t* mstdnt,
char* _url,
@ -72,6 +71,11 @@ int mastodont_fetch_curl(mastodont_t* mstdnt,
curl_easy_setopt(mstdnt->curl, CURLOPT_URL, url);
curl_easy_setopt(mstdnt->curl, CURLOPT_WRITEFUNCTION, write_callback);
curl_easy_setopt(mstdnt->curl, CURLOPT_WRITEDATA, results);
/* Should we verify the peer's SSL cert? */
curl_easy_setopt(mstdnt->curl, CURLOPT_SSL_VERIFYPEER,
!MSTDNT_T_FLAG_ISSET(mstdnt, MSTDNT_FLAG_SSL_UNVERIFIED));
curl_easy_setopt(mstdnt->curl, CURLOPT_SSL_VERIFYHOST,
!MSTDNT_T_FLAG_ISSET(mstdnt, MSTDNT_FLAG_SSL_UNVERIFIED));
/* PUT, POST, GET */
curl_easy_setopt(mstdnt->curl, request_t, 1);

34
src/navigation.c Normal file
View file

@ -0,0 +1,34 @@
/*
* Treebird - Lightweight frontend for Pleroma
* Copyright (C) 2022 Nekobit
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "navigation.h"
#include "easprintf.h"
// Pages
#include "../static/navigation.chtml"
char* construct_navigation_box(char* prev_id, char* next_id, size_t size)
{
char* nav_html;
size_t s = easprintf(&nav_html, data_navigation_html,
prev_id,
next_id);
if (
}

26
src/navigation.h Normal file
View file

@ -0,0 +1,26 @@
/*
* Treebird - Lightweight frontend for Pleroma
* Copyright (C) 2022 Nekobit
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef NAVIGATION_H
#define NAVIGATION_H
#include <stddef.h>
#include <mastodont.h>
char* construct_navigation_box(char* prev_id, char* next_id, size_t size);
#endif // NAVIGATION_H