diff --git a/Makefile.config.in b/Makefile.config.in index 1c27a63a..b343a7e0 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -130,6 +130,7 @@ CONFIG_FTP = @CONFIG_FTP@ CONFIG_GLOBHIST = @CONFIG_GLOBHIST@ CONFIG_GNUTLS = @CONFIG_GNUTLS@ CONFIG_GNUTLS_OPENSSL_COMPAT = @CONFIG_GNUTLS_OPENSSL_COMPAT@ +CONFIG_GEMINI = @CONFIG_GEMINI@ CONFIG_GOPHER = @CONFIG_GOPHER@ CONFIG_GPM = @CONFIG_GPM@ CONFIG_GZIP = @CONFIG_GZIP@ diff --git a/config2.h.in b/config2.h.in index e9943b95..93cfda02 100644 --- a/config2.h.in +++ b/config2.h.in @@ -88,6 +88,9 @@ /* Define if you want: GNUTLS support */ #mesondefine CONFIG_GNUTLS +/* Define if you want: Gemini protocol support */ +#mesondefine CONFIG_GEMINI + /* Define if you want: Gopher protocol support */ #mesondefine CONFIG_GOPHER diff --git a/configure.ac b/configure.ac index 57cf7bfe..96421f5a 100644 --- a/configure.ac +++ b/configure.ac @@ -1443,6 +1443,9 @@ fi EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol], [ --disable-ftp disable ftp protocol support]) +EL_ARG_ENABLE(CONFIG_GEMINI, gemini, [Gemini protocol], + [ --enable-gemini enable gemini protocol support]) + EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol], [ --enable-gopher enable gopher protocol support]) diff --git a/meson.build b/meson.build index 7faa249e..a8903049 100644 --- a/meson.build +++ b/meson.build @@ -26,6 +26,7 @@ conf_data.set('CONFIG_MIMETYPES', get_option('mimetypes')) conf_data.set('CONFIG_IPV6', get_option('ipv6')) conf_data.set('CONFIG_BITTORRENT', get_option('bittorrent')) conf_data.set('CONFIG_DATA', get_option('data')) +conf_data.set('CONFIG_GEMINI', get_option('gemini')) conf_data.set('CONFIG_URI_REWRITE', get_option('uri-rewrite')) conf_data.set('CONFIG_CGI', get_option('cgi')) diff --git a/meson_options.txt b/meson_options.txt index 162c5ce1..f01717c3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -61,3 +61,4 @@ option('libev', type: 'boolean', value: false, description: 'compile with libev option('libevent', type: 'boolean', value: false, description: 'compile with libevent. Note that libev has precedence') option('x', type: 'boolean', value: false, description: 'use the X Window System') option('xml', type: 'boolean', value: false, description: 'libxml++') +option('gemini', type: 'boolean', value: false, description: 'gemini protocol support') diff --git a/src/protocol/Makefile b/src/protocol/Makefile index d4a2d7e8..dd6dd66c 100644 --- a/src/protocol/Makefile +++ b/src/protocol/Makefile @@ -5,12 +5,13 @@ SUBDIRS-$(CONFIG_BITTORRENT) += bittorrent SUBDIRS-$(CONFIG_FINGER) += finger SUBDIRS-$(CONFIG_FSP) += fsp SUBDIRS-$(CONFIG_FTP) += ftp +SUBDIRS-$(CONFIG_GEMINI) += gemini SUBDIRS-$(CONFIG_GOPHER) += gopher SUBDIRS-$(CONFIG_NNTP) += nntp SUBDIRS-$(CONFIG_SMB) += smb SUBDIRS-$(CONFIG_URI_REWRITE) += rewrite -SUBDIRS = auth file gemini http test +SUBDIRS = auth file http test OBJS-$(CONFIG_DATA) += data.o diff --git a/src/protocol/gemini/gemini.c b/src/protocol/gemini/gemini.c index ff5dd9a6..2b8b09ea 100644 --- a/src/protocol/gemini/gemini.c +++ b/src/protocol/gemini/gemini.c @@ -37,6 +37,7 @@ static void done_gemini(); +static void gemini_got_header(struct socket *socket, struct read_buffer *rb); struct module gemini_protocol_module = struct_module( /* name: */ N_("Gemini"), @@ -48,12 +49,15 @@ struct module gemini_protocol_module = struct_module( /* done: */ done_gemini ); - static void done_gemini(void) { } +struct gemini_connection_info { + int code; +}; + static void gemini_end_request(struct connection *conn, struct connection_state state, int notrunc) @@ -80,7 +84,7 @@ done_gemini_connection(struct connection *conn) conn->done = NULL; } -struct gemini_connection_info * +static struct gemini_connection_info * init_gemini_connection_info(struct connection *conn) { struct gemini_connection_info *gemini; @@ -257,7 +261,7 @@ get_gemini_code(struct read_buffer *rb, int *code) return 0; } -void +static void gemini_got_header(struct socket *socket, struct read_buffer *rb) { struct connection *conn = socket->conn; diff --git a/src/protocol/gemini/gemini.h b/src/protocol/gemini/gemini.h index 266690f3..be5a10c0 100644 --- a/src/protocol/gemini/gemini.h +++ b/src/protocol/gemini/gemini.h @@ -13,16 +13,13 @@ struct connection; struct read_buffer; struct socket; -struct gemini_connection_info { - int code; -}; - extern struct module gemini_protocol_module; +#ifdef CONFIG_GEMINI extern protocol_handler_T gemini_protocol_handler; - -struct gemini_connection_info *init_gemini_connection_info(struct connection *conn); -void gemini_got_header(struct socket *, struct read_buffer *); +#else +#define gemini_protocol_handler NULL +#endif #ifdef __cplusplus } diff --git a/src/protocol/meson.build b/src/protocol/meson.build index b0ceb8f1..57c75e2b 100644 --- a/src/protocol/meson.build +++ b/src/protocol/meson.build @@ -10,6 +10,9 @@ endif if conf_data.get('CONFIG_FTP') subdir('ftp') endif +if conf_data.get('CONFIG_GEMINI') + subdir('gemini') +endif if conf_data.get('CONFIG_GOPHER') subdir('gopher') endif @@ -24,7 +27,6 @@ if conf_data.get('CONFIG_URI_REWRITE') endif subdir('auth') subdir('file') -subdir('gemini') subdir('http') if conf_data.get('CONFIG_DATA')