A simple/toy client in C
Omar Polo op at omarpolo.com
Tue Sep 21 16:51:15 BST 2021
stack@tilde.club writes:
> I've been trying to put together a very simple C toy client - just
> enought to connect to a Gemini server and get a page (no UI). My goal
> is to figure out how a client connects, wrap a Common Lisp CFFI and
> make a Common Lisp client (which is why C is a requirement).
My common lisp knowledge is pretty limited, but there's a reason you
can't use cl+ssl? AFAIK it should works. I know there are at least one
server (which I forgot the name, sorry) and a client (tinmop) which are
written entirely in common lisp.
> I am using BearSSL (for its minimalism). I started with the sample
> provided, modified for the Gemini request. I keep getting stuck with
> error 62 (probably because I don't understand how to deal with TLS).
> I attempted to generate the CA boilerplate code, but there are some
> ominous hints that the code is HTTPS-specific.
>
> Could someone point me in the right direction (Ideally, to a repo with
> a C example :) I am not married to BearSSL - it just seemed an OK
> starting point.
I've never used anything else beside libtls, so I can't comment (or
compare it to) other libraries, but I'm quite fond of it. It's really
well-documented (well, it's from OpenBSD after all :P) and really nice
to use.
As part of the regress suite of gmid (a gemini server) I've wrote a
really simple gemini client which should fits your criteria:
https://git.omarpolo.com/gmid/tree/regress/gg.c
It's mean to be compiled as part of gmid, but it's really easy to
extract (just define GEMINI_URL_LEN and replace strlcat/strlcpy or add
libbsd as deps)
Cheers!
> Many thanks.
Archive home | About this archive