cgi: more graceful error handling in absence of server
[disorder] / lib / client.c
index b7292c5..1dac922 100644 (file)
@@ -165,6 +165,10 @@ static int disorder_simple_v(disorder_client *c,
   const char *arg;
   struct dynstr d;
 
+  if(!c->fpout) {
+    error(0, "not connected to server");
+    return -1;
+  }
   if(cmd) {
     dynstr_init(&d);
     dynstr_append_string(&d, cmd);
@@ -1148,6 +1152,14 @@ int disorder_make_cookie(disorder_client *c, char **cookiep) {
                 cookiep);
 }
 
+/** @brief Revoke the cookie used by this session
+ * @param c Client
+ * @return 0 on success, non-0 on error
+ */
+int disorder_revoke(disorder_client *c) {
+  return disorder_simple(c, 0, "revoke", (char *)0);
+}
+
 /*
 Local Variables:
 c-basic-offset:2