Commit b6835ce4 authored by Bastien Durel's avatar Bastien Durel
Browse files

gio tls

parents
SRC=main.cpp
OBJ=$(SRC:.cpp=.o)
NAME=cnx
CXXFLAGS=$(shell pkg-config --cflags gio-2.0) -g3 -O0
LDFLAGS=$(shell pkg-config --libs gio-2.0)
$(NAME): $(OBJ)
$(CXX) -o $(NAME) $(LDFLAGS) $(OBJ)
clean:
rm -f $(OBJ) *~
fclean: clean
rm -f $(NAME)
test: $(NAME)
./$(NAME)
#include <gio/gio.h>
#include <iostream>
using namespace std;
const GTlsCertificateFlags FLAGS = (GTlsCertificateFlags)
(G_TLS_CERTIFICATE_EXPIRED | G_TLS_CERTIFICATE_REVOKED | G_TLS_CERTIFICATE_BAD_IDENTITY);
int main() {
cout << "start" << endl;
GError *err = 0;
GSocketClient *client = g_socket_client_new ();
cout << "client: " << client << endl;
g_socket_client_set_tls (client, true);
g_socket_client_set_tls_validation_flags (client, FLAGS);
GSocketConnection * cnx = g_socket_client_connect_to_host
(client, "arrakeen.geekwu.org", 443, NULL, &err);
if (err != NULL) {
cerr << "Unable to connect: " << err->message << endl;
}
cout << "cnx: " << cnx << endl;
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment