mirror of
https://git.sr.ht/~sircmpwn/gmni
synced 2024-06-01 21:36:04 +02:00
parent
fd914b3aa4
commit
eb01fde600
|
@ -23,7 +23,7 @@ gemini_get_addrinfo(struct Curl_URL *uri, struct gemini_options *options,
|
|||
free(uport);
|
||||
}
|
||||
|
||||
if (options && options->addr->ai_family != AF_UNSPEC) {
|
||||
if (options && options->addr && options->addr->ai_family != AF_UNSPEC) {
|
||||
*addr = options->addr;
|
||||
} else {
|
||||
struct addrinfo hints = {0};
|
||||
|
|
13
src/gmnic.c
13
src/gmnic.c
|
@ -1,12 +1,15 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <netdb.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/err.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "client.h"
|
||||
|
||||
|
@ -35,15 +38,19 @@ main(int argc, char *argv[])
|
|||
enum input_mode input_mode = INPUT_READ;
|
||||
FILE *input_source = stdin;
|
||||
bool follow_redirects = false, linefeed = true;
|
||||
struct addrinfo hints = {0};
|
||||
struct gemini_options opts = {
|
||||
.hints = &hints,
|
||||
};
|
||||
|
||||
int c;
|
||||
while ((c = getopt(argc, argv, "46C:d:D:hlLiIN")) != -1) {
|
||||
switch (c) {
|
||||
case '4':
|
||||
assert(0); // TODO
|
||||
hints.ai_family = AF_INET;
|
||||
break;
|
||||
case '6':
|
||||
assert(0); // TODO
|
||||
hints.ai_family = AF_INET6;
|
||||
break;
|
||||
case 'C':
|
||||
assert(0); // TODO: Client certificates
|
||||
|
@ -104,7 +111,7 @@ main(int argc, char *argv[])
|
|||
int ret = 0;
|
||||
while (!exit) {
|
||||
struct gemini_response resp;
|
||||
enum gemini_result r = gemini_request(url, NULL, &resp);
|
||||
enum gemini_result r = gemini_request(url, &opts, &resp);
|
||||
if (r != GEMINI_OK) {
|
||||
fprintf(stderr, "Error: %s\n", gemini_strerr(r, &resp));
|
||||
ret = (int)r;
|
||||
|
|
Loading…
Reference in New Issue