Manage ssl errors with GTlsCertificateFlags

Keep a GTlsCertificateFlags in Client for TLS errors.
If we don't use a ssl connection, set it to a value greater than maximum
error flag value (which is G_TLS_CERTIFICATE_VALIDATE_ALL for all
possible errors).
This commit is contained in:
Quentin Rameau 2015-11-18 18:44:25 +01:00
parent e9ec482049
commit 58c4e18975
1 changed files with 5 additions and 6 deletions

11
surf.c
View File

@ -60,11 +60,12 @@ typedef struct Client {
WebKitWebView *view; WebKitWebView *view;
WebKitWebInspector *inspector; WebKitWebInspector *inspector;
WebKitHitTestResult *mousepos; WebKitHitTestResult *mousepos;
GTlsCertificateFlags tlsflags;
const char *title, *targeturi; const char *title, *targeturi;
const char *needle; const char *needle;
gint progress; gint progress;
struct Client *next; struct Client *next;
gboolean zoomed, fullscreen, isinspecting, sslfailed; gboolean zoomed, fullscreen, isinspecting;
} Client; } Client;
typedef struct { typedef struct {
@ -896,6 +897,7 @@ newclient(Client *rc)
clients = c; clients = c;
c->view = newview(c, rc ? rc->view : NULL); c->view = newview(c, rc ? rc->view : NULL);
c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
return c; return c;
} }
@ -1518,11 +1520,8 @@ getpagestat(Client *c)
{ {
const char *uri = geturi(c); const char *uri = geturi(c);
if (strstr(uri, "https://") == uri) pagestats[0] = c->tlsflags > G_TLS_CERTIFICATE_VALIDATE_ALL ? '-' :
pagestat[0] = c->sslfailed ? 'U' : 'T'; c->tlsflags > 0 ? 'U' : 'T';
else
pagestat[0] = '-';
pagestat[1] = '\0'; pagestat[1] = '\0';
} }