diff --git a/configure b/configure

index 7412cf545fa96e6be169c0055778b83a06b557f5..44db11c4765077677a1f506f034c846cc736ab8c 100755

--- a/configure

+++ b/configure

@@ -7,7 +7,9 @@ genrules gmni \

	src/client.c \

	src/escape.c \

	src/gmni.c \

}

gmnlm() {

@@ -16,6 +18,7 @@ src/client.c \

	src/escape.c \

	src/gmnlm.c \

	src/parser.c \

	src/url.c \

	src/util.c

}

diff --git a/doc/gmni.scd b/doc/gmni.scd

index 0d84d4d974f2c38b426f6ae85d228cdd4847cbda..2c1dc54272aaf3a4cbd6b1c13e29323f418f199b 100644

--- a/doc/gmni.scd

+++ b/doc/gmni.scd

@@ -6,7 +6,7 @@ gmni - Gemini client

SYNPOSIS

-gmni [-46lLiIN] [-E path] [-d input] [-D path] gemini://...

+gmni [-46lLiIN] [-j mode] [-E path] [-d input] [-D path] gemini://...

DESCRIPTION

@@ -51,6 +51,11 @@ this behavior.

-L

Follow redirects.

+-j mode

-i

Print the response status and meta text to stdout.

diff --git a/doc/gmnlm.scd b/doc/gmnlm.scd

index c5e7bf7f6b189f984e01ea2a942f47acb993f7e7..b11f3612e044ad0667d8c4d306445ae86e9f73d4 100644

--- a/doc/gmnlm.scd

+++ b/doc/gmnlm.scd

@@ -6,13 +6,18 @@ gmnlm - Gemini line-mode browser

SYNPOSIS

-gmnlm [-PU] gemini://...

+gmnlm [-PU] [-j mode] gemini://...

DESCRIPTION

gmnlm is an interactive line-mode Gemini browser.

OPTIONS

+-j mode

-P

Disable pagination.

diff --git a/include/gmni.h b/include/gmni.h

index 4240c6231010ebb86aead2d49700fe2e3d00b65c..7e27b489d71fd3a43ca60292b17d56cab3caa5f8 100644

--- a/include/gmni.h

+++ b/include/gmni.h

@@ -13,6 +13,7 @@ GEMINI_ERR_NOT_GEMINI,

GEMINI_ERR_RESOLVE,

GEMINI_ERR_CONNECT,

GEMINI_ERR_SSL,

GEMINI_ERR_IO,

GEMINI_ERR_PROTOCOL,

};

@@ -64,10 +65,6 @@ struct gemini_options {

// If NULL, an SSL context will be created. If unset, the ssl field

// must also be NULL.

SSL_CTX *ssl_ctx;

// If ai_family != AF_UNSPEC (the default value on most systems), the

// client will connect to this address and skip name resolution.

diff --git a/include/tofu.h b/include/tofu.h

new file mode 100644

index 0000000000000000000000000000000000000000..29aa9bc21567868cafb25a09dbc25ea0685ab01c

--- /dev/null

+++ b/include/tofu.h

@@ -0,0 +1,48 @@

+#ifndef GEMINI_TOFU_H

+#define GEMINI_TOFU_H

+#include <limits.h>

+#include <openssl/ssl.h>

+#include <openssl/x509.h>

+#include <time.h>

+enum tofu_error {

+};

+enum tofu_action {

+};

+struct known_host {

+};

+// Called when the user needs to be prompted to agree to trust an unknown

+// certificate. Return true to trust this certificate.

+typedef enum tofu_action (tofu_callback_t)(enum tofu_error error,

+struct gemini_tofu {

+};

+void gemini_tofu_init(struct gemini_tofu *tofu,

+#endif

diff --git a/src/client.c b/src/client.c

index d8b67d7b9f47b4473ba6eb278853ea0565739f09..07460f917b153b0d368eb2a98f368aa6a5df56a4 100644

--- a/src/client.c

+++ b/src/client.c

@@ -95,6 +95,7 @@ {

assert(url);

assert(resp);

resp->meta = NULL;

if (strlen(url) > 1024) {

	return GEMINI_ERR_INVALID_URL;

}

@@ -110,7 +111,7 @@ res = GEMINI_ERR_INVALID_URL;

	goto cleanup;

}

if (curl_url_get(uri, CURLUPART_SCHEME, &scheme, 0) != CURLUE_OK) {

	res = GEMINI_ERR_INVALID_URL;

	goto cleanup;

@@ -120,6 +121,10 @@ res = GEMINI_ERR_NOT_GEMINI;

		goto cleanup;

	}

}

if (options && options->ssl_ctx) {

	resp->ssl_ctx = options->ssl_ctx;

@@ -127,42 +132,54 @@ SSL_CTX_up_ref(options->ssl_ctx);

} else {

	resp->ssl_ctx = SSL_CTX_new(TLS_method());

	assert(resp->ssl_ctx);

}

BIO *sbio = BIO_new(BIO_f_ssl());

}

resp->bio = BIO_new(BIO_f_buffer());

BIO_push(resp->bio, sbio);

char req[1024 + 3];

assert(r > 0);

r = BIO_puts(sbio, req);

@@ -199,6 +216,10 @@

cleanup:

curl_url_cleanup(uri);

return res;

+ssl_error:

}

void

@@ -248,6 +269,8 @@ case GEMINI_ERR_SSL:

	return ERR_error_string(

		SSL_get_error(resp->ssl, resp->status),

		NULL);

case GEMINI_ERR_IO:

	return "I/O error";

case GEMINI_ERR_PROTOCOL:

diff --git a/src/gmni.c b/src/gmni.c

index dc0c5c7f61679369fe4fadafd0508147868cc3c3..c13e0cd55623f557a8dc676d69aea54661b11faf 100644

--- a/src/gmni.c

+++ b/src/gmni.c

@@ -13,6 +13,7 @@ #include <sys/types.h>

#include <termios.h>

#include <unistd.h>

#include "gmni.h"

+#include "tofu.h"

static void

usage(const char *argv_0)

@@ -57,6 +58,55 @@ }

return input;

}

+struct tofu_config {

+};

+static enum tofu_action

+tofu_callback(enum tofu_error error, const char *fingerprint,

+{

+}

int

main(int argc, char *argv[])

{

@@ -71,7 +121,6 @@ enum input_mode {

	INPUT_READ,

	INPUT_SUPPRESS,

};

enum input_mode input_mode = INPUT_READ;

FILE *input_source = stdin;

@@ -82,9 +131,11 @@ struct addrinfo hints = {0};

struct gemini_options opts = {

	.hints = &hints,

};

int c;

	switch (c) {

	case '4':

		hints.ai_family = AF_INET;

@@ -115,6 +166,18 @@ break;

	case 'h':

		usage(argv[0]);

		return 0;

	case 'l':

		linefeed = false;

		break;

@@ -153,6 +216,8 @@ }

SSL_load_error_strings();

ERR_load_crypto_strings();

bool exit = false;

char *url = strdup(argv[optind]);

diff --git a/src/gmnlm.c b/src/gmnlm.c

index 69b9a75ca1caab6f7e5f74685e550539be149ab6..41284df2235e869f49e542f5e1f2dcc240deb684 100644

--- a/src/gmnlm.c

+++ b/src/gmnlm.c

@@ -13,6 +13,7 @@ #include <sys/ioctl.h>

#include <termios.h>

#include <unistd.h>

#include "gmni.h"

+#include "tofu.h"

#include "url.h"

#include "util.h"

@@ -29,6 +30,8 @@

struct browser {

bool pagination, unicode;

struct gemini_options opts;

FILE *tty;

char *plain_url;

@@ -657,22 +660,113 @@

return false;

}

+static enum tofu_action

+tofu_callback(enum tofu_error error, const char *fingerprint,

+{

+}

int

main(int argc, char *argv[])

{

struct browser browser = {

	.pagination = true,

	.unicode = true,

	.url = curl_url(),

	.tty = fopen("/dev/tty", "w+"),

};

int c;

	switch (c) {

	case 'h':

		usage(argv[0]);

		return 0;

	case 'P':

		browser.pagination = false;

		break;

@@ -695,6 +789,8 @@

SSL_load_error_strings();

ERR_load_crypto_strings();

browser.opts.ssl_ctx = SSL_CTX_new(TLS_method());

struct gemini_response resp;

browser.running = true;

diff --git a/src/tofu.c b/src/tofu.c

new file mode 100644

index 0000000000000000000000000000000000000000..e8efeaf69fcb9bd890711f76959e86efa75cfec6

--- /dev/null

+++ b/src/tofu.c

@@ -0,0 +1,201 @@

+#include <assert.h>

+#include <errno.h>

+#include <libgen.h>

+#include <limits.h>

+#include <openssl/asn1.h>

+#include <openssl/evp.h>

+#include <openssl/ssl.h>

+#include <openssl/x509.h>

+#include <stdio.h>

+#include <string.h>

+#include <time.h>

+#include "tofu.h"

+#include "util.h"

+static int

+verify_callback(X509_STORE_CTX *ctx, void *data)

+{

+next:

+callback:

+invalid_cert:

+}

+void

+gemini_tofu_init(struct gemini_tofu *tofu,

+{

+}

Proxy Information
Original URL
gemini://gmn.clttr.info/sources/cgmnlm.git/commits/02f6af661513683f0c6c1465c5ff1dd8f03a30c9.patch
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
168.361238 milliseconds
Gemini-to-HTML Time
9.665896 milliseconds

This content has been proxied by September (ba2dc).