2020-12-24 16:49:55 +01:00
|
|
|
/*
|
2022-01-01 17:36:17 +01:00
|
|
|
* Copyright (c) 2020, 2021, 2022 Omar Polo <op@omarpolo.com>
|
2020-12-24 16:49:55 +01:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
#ifndef GMID_H
|
|
|
|
#define GMID_H
|
|
|
|
|
2021-02-12 13:47:20 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2021-01-24 19:53:26 +01:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
2021-01-24 19:53:26 +01:00
|
|
|
#include <dirent.h>
|
2021-03-19 20:21:29 +01:00
|
|
|
#include <limits.h>
|
|
|
|
#include <netdb.h>
|
2021-02-04 14:23:15 +01:00
|
|
|
#include <signal.h>
|
2020-12-24 16:48:39 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2021-02-07 22:47:01 +01:00
|
|
|
#include <time.h>
|
2020-12-24 16:48:39 +01:00
|
|
|
#include <tls.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2021-02-09 23:30:04 +01:00
|
|
|
#include <openssl/x509.h>
|
|
|
|
|
2021-10-02 19:20:56 +02:00
|
|
|
#if HAVE_EVENT2
|
|
|
|
# include <event2/event.h>
|
|
|
|
# include <event2/event_compat.h>
|
|
|
|
# include <event2/event_struct.h>
|
|
|
|
# include <event2/buffer.h>
|
|
|
|
# include <event2/buffer_compat.h>
|
|
|
|
# include <event2/bufferevent.h>
|
|
|
|
# include <event2/bufferevent_struct.h>
|
|
|
|
# include <event2/bufferevent_compat.h>
|
|
|
|
#else
|
|
|
|
# include <event.h>
|
|
|
|
#endif
|
|
|
|
|
2022-09-10 16:29:40 +02:00
|
|
|
#define VERSION_STR(n) n " " VERSION
|
|
|
|
#define GE_STRING VERSION_STR("ge")
|
|
|
|
#define GG_STRING VERSION_STR("gg")
|
|
|
|
#define GMID_STRING VERSION_STR("gmid")
|
|
|
|
|
2021-07-10 11:19:44 +02:00
|
|
|
#define GMID_VERSION "gmid/" VERSION
|
2021-05-15 13:11:56 +02:00
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
#define GEMINI_URL_LEN (1024+3) /* URL max len + \r\n + \0 */
|
|
|
|
|
|
|
|
#define SUCCESS 20
|
2021-01-20 19:54:44 +01:00
|
|
|
#define TEMP_REDIRECT 30
|
2020-12-24 16:48:39 +01:00
|
|
|
#define TEMP_FAILURE 40
|
2021-02-01 23:04:51 +01:00
|
|
|
#define CGI_ERROR 42
|
2021-12-29 21:36:54 +01:00
|
|
|
#define PROXY_ERROR 43
|
2020-12-24 16:48:39 +01:00
|
|
|
#define NOT_FOUND 51
|
2021-01-11 15:45:57 +01:00
|
|
|
#define PROXY_REFUSED 53
|
2020-12-24 16:48:39 +01:00
|
|
|
#define BAD_REQUEST 59
|
2021-02-09 23:30:04 +01:00
|
|
|
#define CLIENT_CERT_REQ 60
|
|
|
|
#define CERT_NOT_AUTH 61
|
2020-12-24 16:48:39 +01:00
|
|
|
|
2021-01-28 17:25:59 +01:00
|
|
|
/* maximum hostname and label length, +1 for the NUL-terminator */
|
|
|
|
#define DOMAIN_NAME_LEN (253+1)
|
|
|
|
#define LABEL_LEN (63+1)
|
2021-01-27 11:47:49 +01:00
|
|
|
|
2022-09-10 11:40:05 +02:00
|
|
|
#define MEDIATYPE_NAMEMAX 128 /* file name extension */
|
|
|
|
#define MEDIATYPE_TYPEMAX 128 /* length of type/subtype */
|
|
|
|
|
2022-10-05 17:10:44 +02:00
|
|
|
#define FCGI_NAME_MAX 511
|
|
|
|
#define FCGI_VAL_MAX 511
|
|
|
|
|
2021-05-09 20:23:36 +02:00
|
|
|
#define FCGI_MAX 32
|
2023-06-06 10:34:31 +02:00
|
|
|
#define PREFORK_MAX 16
|
2021-03-03 18:22:01 +01:00
|
|
|
|
2021-12-29 20:24:33 +01:00
|
|
|
struct iri {
|
|
|
|
char *schema;
|
|
|
|
char *host;
|
|
|
|
char *port;
|
|
|
|
uint16_t port_no;
|
|
|
|
char *path;
|
|
|
|
char *query;
|
|
|
|
char *fragment;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct parser {
|
|
|
|
char *iri;
|
|
|
|
struct iri *parsed;
|
|
|
|
const char *err;
|
|
|
|
};
|
|
|
|
|
2021-05-09 20:23:36 +02:00
|
|
|
struct fcgi {
|
|
|
|
int id;
|
2022-10-05 17:10:44 +02:00
|
|
|
char path[PATH_MAX];
|
|
|
|
char port[32];
|
2021-05-09 20:23:36 +02:00
|
|
|
};
|
|
|
|
extern struct fcgi fcgi[FCGI_MAX];
|
|
|
|
|
2022-01-02 17:33:28 +01:00
|
|
|
TAILQ_HEAD(proxyhead, proxy);
|
2022-01-01 18:08:39 +01:00
|
|
|
struct proxy {
|
2022-10-05 17:10:44 +02:00
|
|
|
char match_proto[32];
|
|
|
|
char match_host[HOST_NAME_MAX + 1];
|
|
|
|
char match_port[32];
|
2022-01-02 17:33:28 +01:00
|
|
|
|
2022-10-05 17:10:44 +02:00
|
|
|
char host[HOST_NAME_MAX + 1];
|
|
|
|
char port[32];
|
|
|
|
char sni[HOST_NAME_MAX];
|
2022-01-01 21:16:14 +01:00
|
|
|
int notls;
|
2022-01-01 20:04:50 +01:00
|
|
|
uint32_t protocols;
|
2022-01-01 19:50:10 +01:00
|
|
|
int noverifyname;
|
2022-01-01 18:08:39 +01:00
|
|
|
uint8_t *cert;
|
|
|
|
size_t certlen;
|
|
|
|
uint8_t *key;
|
|
|
|
size_t keylen;
|
2022-01-05 00:14:34 +01:00
|
|
|
X509_STORE *reqca;
|
2022-01-02 17:33:28 +01:00
|
|
|
|
|
|
|
TAILQ_ENTRY(proxy) proxies;
|
2022-01-01 18:08:39 +01:00
|
|
|
};
|
|
|
|
|
2021-03-31 18:32:18 +02:00
|
|
|
TAILQ_HEAD(lochead, location);
|
2021-01-24 15:11:40 +01:00
|
|
|
struct location {
|
2022-10-05 17:10:44 +02:00
|
|
|
char match[128];
|
|
|
|
char lang[32];
|
|
|
|
char default_mime[MEDIATYPE_TYPEMAX];
|
|
|
|
char index[PATH_MAX];
|
2021-01-24 19:53:26 +01:00
|
|
|
int auto_index; /* 0 auto, -1 off, 1 on */
|
2021-02-06 18:22:37 +01:00
|
|
|
int block_code;
|
2022-10-05 17:10:44 +02:00
|
|
|
char block_fmt[GEMINI_URL_LEN];
|
2021-02-06 18:22:37 +01:00
|
|
|
int strip;
|
2021-02-09 23:30:04 +01:00
|
|
|
X509_STORE *reqca;
|
2021-02-22 09:53:14 +01:00
|
|
|
int disable_log;
|
2021-05-09 20:23:36 +02:00
|
|
|
int fcgi;
|
2021-03-31 18:32:18 +02:00
|
|
|
|
2022-10-05 17:10:44 +02:00
|
|
|
char dir[PATH_MAX];
|
2021-04-30 19:16:34 +02:00
|
|
|
int dirfd;
|
|
|
|
|
2021-03-31 18:32:18 +02:00
|
|
|
TAILQ_ENTRY(location) locations;
|
2021-01-24 15:11:40 +01:00
|
|
|
};
|
|
|
|
|
2021-04-28 14:43:17 +02:00
|
|
|
TAILQ_HEAD(envhead, envlist);
|
|
|
|
struct envlist {
|
2022-10-05 17:10:44 +02:00
|
|
|
char name[FCGI_NAME_MAX];
|
|
|
|
char value[FCGI_VAL_MAX];
|
2021-04-28 14:43:17 +02:00
|
|
|
TAILQ_ENTRY(envlist) envs;
|
|
|
|
};
|
|
|
|
|
2021-04-29 20:23:35 +02:00
|
|
|
TAILQ_HEAD(aliashead, alist);
|
|
|
|
struct alist {
|
2022-10-05 17:10:44 +02:00
|
|
|
char alias[HOST_NAME_MAX + 1];
|
2021-04-29 20:23:35 +02:00
|
|
|
TAILQ_ENTRY(alist) aliases;
|
|
|
|
};
|
|
|
|
|
2021-03-31 18:32:18 +02:00
|
|
|
extern TAILQ_HEAD(vhosthead, vhost) hosts;
|
2021-01-15 10:17:43 +01:00
|
|
|
struct vhost {
|
2022-10-05 17:10:44 +02:00
|
|
|
char domain[HOST_NAME_MAX + 1];
|
|
|
|
char cert[PATH_MAX];
|
|
|
|
char key[PATH_MAX];
|
|
|
|
char ocsp[PATH_MAX];
|
2021-01-30 13:04:20 +01:00
|
|
|
|
2021-03-31 18:32:18 +02:00
|
|
|
TAILQ_ENTRY(vhost) vhosts;
|
|
|
|
|
2021-07-07 11:46:37 +02:00
|
|
|
/*
|
|
|
|
* the first location rule is always '*' and holds the default
|
2021-03-31 18:32:18 +02:00
|
|
|
* settings for the vhost, then follows the "real" location
|
2021-07-07 11:46:37 +02:00
|
|
|
* rules as specified in the configuration.
|
|
|
|
*/
|
2021-03-31 18:32:18 +02:00
|
|
|
struct lochead locations;
|
2021-04-28 14:43:17 +02:00
|
|
|
|
2021-06-11 17:48:56 +02:00
|
|
|
struct envhead params;
|
2021-04-29 20:23:35 +02:00
|
|
|
struct aliashead aliases;
|
2022-01-02 17:33:28 +01:00
|
|
|
struct proxyhead proxies;
|
2021-01-15 10:17:43 +01:00
|
|
|
};
|
|
|
|
|
2021-01-18 19:48:37 +01:00
|
|
|
struct etm { /* extension to mime */
|
2022-09-10 11:40:05 +02:00
|
|
|
char mime[MEDIATYPE_TYPEMAX];
|
|
|
|
char ext[MEDIATYPE_NAMEMAX];
|
2021-01-18 19:48:37 +01:00
|
|
|
};
|
|
|
|
|
2021-01-21 16:01:37 +01:00
|
|
|
struct mime {
|
2021-01-18 19:48:37 +01:00
|
|
|
struct etm *t;
|
2022-04-08 15:52:35 +02:00
|
|
|
size_t len;
|
|
|
|
size_t cap;
|
2021-01-18 19:48:37 +01:00
|
|
|
};
|
|
|
|
|
2021-01-15 10:17:43 +01:00
|
|
|
struct conf {
|
2021-02-07 16:30:28 +01:00
|
|
|
/* from command line */
|
|
|
|
int foreground;
|
|
|
|
int verbose;
|
|
|
|
|
|
|
|
/* in the config */
|
2021-01-25 11:30:07 +01:00
|
|
|
int port;
|
|
|
|
int ipv6;
|
|
|
|
uint32_t protos;
|
|
|
|
struct mime mime;
|
2022-09-10 11:21:09 +02:00
|
|
|
char chroot[PATH_MAX];
|
|
|
|
char user[LOGIN_NAME_MAX];
|
2021-02-07 13:05:32 +01:00
|
|
|
int prefork;
|
2021-01-15 10:17:43 +01:00
|
|
|
};
|
|
|
|
|
2021-02-08 13:44:34 +01:00
|
|
|
extern const char *config_path;
|
2021-01-15 10:17:43 +01:00
|
|
|
extern struct conf conf;
|
2021-02-23 13:05:54 +01:00
|
|
|
|
2023-06-06 10:34:31 +02:00
|
|
|
extern struct imsgbuf logibuf, servibuf[PREFORK_MAX];
|
2021-02-04 14:23:15 +01:00
|
|
|
|
2023-06-06 10:34:31 +02:00
|
|
|
extern int servpipes[PREFORK_MAX];
|
2021-03-03 18:22:01 +01:00
|
|
|
|
2021-03-19 20:21:29 +01:00
|
|
|
typedef void (imsg_handlerfn)(struct imsgbuf*, struct imsg*, size_t);
|
|
|
|
|
2021-10-02 19:20:56 +02:00
|
|
|
enum {
|
|
|
|
REQUEST_UNDECIDED,
|
|
|
|
REQUEST_FILE,
|
|
|
|
REQUEST_DIR,
|
|
|
|
REQUEST_FCGI,
|
2021-12-29 21:36:54 +01:00
|
|
|
REQUEST_PROXY,
|
2021-10-02 19:20:56 +02:00
|
|
|
REQUEST_DONE,
|
|
|
|
};
|
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
struct client {
|
2021-10-07 13:20:34 +02:00
|
|
|
uint32_t id;
|
2020-12-24 16:48:39 +01:00
|
|
|
struct tls *ctx;
|
2021-10-02 19:20:56 +02:00
|
|
|
char *req;
|
2022-03-27 14:52:59 +02:00
|
|
|
size_t reqlen;
|
2021-01-20 19:54:44 +01:00
|
|
|
struct iri iri;
|
2021-01-27 11:47:49 +01:00
|
|
|
char domain[DOMAIN_NAME_LEN];
|
2021-05-09 20:23:36 +02:00
|
|
|
|
2021-10-02 19:20:56 +02:00
|
|
|
struct bufferevent *bev;
|
|
|
|
|
|
|
|
int type;
|
|
|
|
|
|
|
|
struct bufferevent *cgibev;
|
|
|
|
|
2022-01-02 17:33:28 +01:00
|
|
|
struct proxy *proxy;
|
2021-12-29 21:36:54 +01:00
|
|
|
struct bufferevent *proxybev;
|
|
|
|
struct tls *proxyctx;
|
2022-01-27 10:55:52 +01:00
|
|
|
int proxyevset;
|
2021-12-29 21:36:54 +01:00
|
|
|
struct event proxyev;
|
|
|
|
|
2021-10-02 19:20:56 +02:00
|
|
|
char *header;
|
2021-05-09 20:23:36 +02:00
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
int code;
|
|
|
|
const char *meta;
|
2021-02-08 11:01:45 +01:00
|
|
|
int fd, pfd;
|
2021-04-25 14:06:54 +02:00
|
|
|
struct dirent **dir;
|
|
|
|
int dirlen, diroff;
|
2021-03-29 11:42:06 +02:00
|
|
|
|
|
|
|
/* big enough to store STATUS + SPACE + META + CRLF */
|
|
|
|
char sbuf[1029];
|
2021-02-12 12:27:33 +01:00
|
|
|
ssize_t len, off;
|
2021-03-29 11:42:06 +02:00
|
|
|
|
2021-01-10 23:29:22 +01:00
|
|
|
struct sockaddr_storage addr;
|
2021-03-19 20:21:29 +01:00
|
|
|
struct vhost *host; /* host they're talking to */
|
2021-05-15 12:31:43 +02:00
|
|
|
size_t loc; /* location matched */
|
2021-03-19 20:21:29 +01:00
|
|
|
|
2021-10-07 13:20:34 +02:00
|
|
|
SPLAY_ENTRY(client) entry;
|
|
|
|
};
|
|
|
|
SPLAY_HEAD(client_tree_id, client);
|
|
|
|
extern struct client_tree_id clients;
|
2021-05-09 20:23:36 +02:00
|
|
|
|
2021-12-29 21:36:54 +01:00
|
|
|
struct connreq {
|
|
|
|
char host[NI_MAXHOST];
|
|
|
|
char port[NI_MAXSERV];
|
|
|
|
int flag;
|
|
|
|
};
|
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
enum {
|
|
|
|
FILE_EXISTS,
|
|
|
|
FILE_DIRECTORY,
|
|
|
|
FILE_MISSING,
|
|
|
|
};
|
|
|
|
|
2021-03-19 20:21:29 +01:00
|
|
|
enum imsg_type {
|
2021-05-09 20:23:36 +02:00
|
|
|
IMSG_FCGI_REQ,
|
|
|
|
IMSG_FCGI_FD,
|
2021-12-29 21:36:54 +01:00
|
|
|
IMSG_CONN_REQ,
|
|
|
|
IMSG_CONN_FD,
|
2021-03-19 20:21:29 +01:00
|
|
|
IMSG_LOG,
|
2021-07-19 09:31:40 +02:00
|
|
|
IMSG_LOG_REQUEST,
|
2021-06-15 10:06:10 +02:00
|
|
|
IMSG_LOG_TYPE,
|
2021-03-19 20:21:29 +01:00
|
|
|
IMSG_QUIT,
|
|
|
|
};
|
|
|
|
|
2020-12-25 13:13:12 +01:00
|
|
|
/* gmid.c */
|
2021-01-25 15:08:31 +01:00
|
|
|
char *data_dir(void);
|
2022-09-06 18:11:09 +02:00
|
|
|
void load_local_cert(struct vhost*, const char*, const char*);
|
2021-01-21 15:49:11 +01:00
|
|
|
int make_socket(int, int);
|
2021-01-25 11:30:07 +01:00
|
|
|
void drop_priv(void);
|
2020-12-24 16:48:39 +01:00
|
|
|
|
2023-06-06 10:18:57 +02:00
|
|
|
/* config.c */
|
|
|
|
void config_init(void);
|
|
|
|
void config_free(void);
|
|
|
|
|
2023-06-06 10:20:09 +02:00
|
|
|
/* parse.y */
|
2021-02-06 18:22:37 +01:00
|
|
|
void yyerror(const char*, ...);
|
2021-01-27 17:45:45 +01:00
|
|
|
void parse_conf(const char*);
|
2021-10-09 23:40:55 +02:00
|
|
|
void print_conf(void);
|
2021-06-29 14:17:40 +02:00
|
|
|
int cmdline_symset(char *);
|
2021-01-27 17:45:45 +01:00
|
|
|
|
2021-01-18 19:18:57 +01:00
|
|
|
/* mime.c */
|
2021-01-21 16:01:37 +01:00
|
|
|
void init_mime(struct mime*);
|
2022-04-08 15:44:49 +02:00
|
|
|
int add_mime(struct mime*, const char*, const char*);
|
|
|
|
int load_default_mime(struct mime*);
|
2022-04-08 17:14:09 +02:00
|
|
|
void sort_mime(struct mime *);
|
2021-01-19 12:28:41 +01:00
|
|
|
const char *mime(struct vhost*, const char*);
|
2022-04-08 15:44:49 +02:00
|
|
|
void free_mime(struct mime *);
|
2021-01-18 19:18:57 +01:00
|
|
|
|
2021-01-18 00:23:58 +01:00
|
|
|
/* server.c */
|
2021-07-06 12:54:27 +02:00
|
|
|
extern int shutting_down;
|
2021-01-24 15:11:40 +01:00
|
|
|
const char *vhost_lang(struct vhost*, const char*);
|
|
|
|
const char *vhost_default_mime(struct vhost*, const char*);
|
|
|
|
const char *vhost_index(struct vhost*, const char*);
|
2021-01-24 19:53:26 +01:00
|
|
|
int vhost_auto_index(struct vhost*, const char*);
|
2021-02-06 18:22:37 +01:00
|
|
|
int vhost_block_return(struct vhost*, const char*, int*, const char**);
|
2021-05-09 20:23:36 +02:00
|
|
|
int vhost_fastcgi(struct vhost*, const char*);
|
2021-05-15 12:31:43 +02:00
|
|
|
int vhost_dirfd(struct vhost*, const char*, size_t*);
|
2021-02-06 18:22:37 +01:00
|
|
|
int vhost_strip(struct vhost*, const char*);
|
2021-02-09 23:30:04 +01:00
|
|
|
X509_STORE *vhost_require_ca(struct vhost*, const char*);
|
2021-02-22 09:53:14 +01:00
|
|
|
int vhost_disable_log(struct vhost*, const char*);
|
2021-05-09 20:23:36 +02:00
|
|
|
|
2021-02-03 15:16:39 +01:00
|
|
|
void mark_nonblock(int);
|
2021-10-02 19:20:56 +02:00
|
|
|
void client_write(struct bufferevent *, void *);
|
2021-05-09 20:23:36 +02:00
|
|
|
void start_reply(struct client*, int, const char*);
|
2021-10-02 19:20:56 +02:00
|
|
|
void client_close(struct client *);
|
2022-03-26 12:32:26 +01:00
|
|
|
struct client *client_by_id(int);
|
2023-06-05 23:10:18 +02:00
|
|
|
int server_main(struct imsgbuf *, int, int);
|
2021-01-18 00:23:58 +01:00
|
|
|
|
2021-10-07 13:20:34 +02:00
|
|
|
int client_tree_cmp(struct client *, struct client *);
|
|
|
|
SPLAY_PROTOTYPE(client_tree_id, client, entry, client_tree_cmp);
|
|
|
|
|
2021-04-25 14:06:54 +02:00
|
|
|
/* dirs.c */
|
|
|
|
int scandir_fd(int, struct dirent***, int(*)(const struct dirent*),
|
|
|
|
int(*)(const struct dirent**, const struct dirent**));
|
|
|
|
int select_non_dot(const struct dirent*);
|
|
|
|
int select_non_dotdot(const struct dirent*);
|
|
|
|
|
2021-05-09 20:23:36 +02:00
|
|
|
/* fcgi.c */
|
2021-09-26 19:00:07 +02:00
|
|
|
void fcgi_read(struct bufferevent *, void *);
|
|
|
|
void fcgi_write(struct bufferevent *, void *);
|
|
|
|
void fcgi_error(struct bufferevent *, short, void *);
|
2021-10-07 12:47:02 +02:00
|
|
|
void fcgi_req(struct client *);
|
2021-05-09 20:23:36 +02:00
|
|
|
|
2021-01-15 15:03:45 +01:00
|
|
|
/* sandbox.c */
|
2023-05-08 12:27:32 +02:00
|
|
|
void sandbox_server_process(void);
|
2021-03-20 09:42:08 +01:00
|
|
|
void sandbox_logger_process(void);
|
2021-01-15 15:03:45 +01:00
|
|
|
|
2021-01-09 21:32:23 +01:00
|
|
|
/* utf8.c */
|
|
|
|
int valid_multibyte_utf8(struct parser*);
|
2021-01-27 11:47:49 +01:00
|
|
|
char *utf8_nth(char*, size_t);
|
2021-01-09 21:32:23 +01:00
|
|
|
|
2021-01-11 14:08:00 +01:00
|
|
|
/* iri.c */
|
|
|
|
int parse_iri(char*, struct iri*, const char**);
|
2021-02-01 12:11:43 +01:00
|
|
|
int serialize_iri(struct iri*, char*, size_t);
|
2022-07-04 11:31:36 +02:00
|
|
|
int encode_path(char *, size_t, const char *);
|
2021-02-07 19:55:04 +01:00
|
|
|
char *pct_decode_str(char *);
|
2020-12-25 13:13:12 +01:00
|
|
|
|
2021-12-29 21:36:54 +01:00
|
|
|
/* proxy.c */
|
|
|
|
int proxy_init(struct client *);
|
|
|
|
|
2021-01-27 11:47:49 +01:00
|
|
|
/* puny.c */
|
2021-01-29 18:11:03 +01:00
|
|
|
int puny_decode(const char*, char*, size_t, const char**);
|
2021-01-27 11:47:49 +01:00
|
|
|
|
2021-01-27 16:35:09 +01:00
|
|
|
/* utils.c */
|
2021-02-04 14:23:15 +01:00
|
|
|
void block_signals(void);
|
|
|
|
void unblock_signals(void);
|
2021-01-27 16:35:09 +01:00
|
|
|
int starts_with(const char*, const char*);
|
|
|
|
int ends_with(const char*, const char*);
|
|
|
|
ssize_t filesize(int);
|
2021-02-01 12:11:43 +01:00
|
|
|
char *absolutify_path(const char*);
|
2021-02-04 14:23:15 +01:00
|
|
|
char *xstrdup(const char*);
|
2021-03-31 18:32:18 +02:00
|
|
|
void *xcalloc(size_t, size_t);
|
2021-02-07 16:30:28 +01:00
|
|
|
void gen_certificate(const char*, const char*, const char*);
|
2021-02-09 23:30:04 +01:00
|
|
|
X509_STORE *load_ca(const char*);
|
|
|
|
int validate_against_ca(X509_STORE*, const uint8_t*, size_t);
|
2021-03-19 20:21:29 +01:00
|
|
|
void dispatch_imsg(struct imsgbuf*, imsg_handlerfn**, size_t);
|
2021-01-27 16:35:09 +01:00
|
|
|
|
2020-12-24 16:48:39 +01:00
|
|
|
#endif
|