Add JSON bool function
[matches/MCTX3420.git] / server / fastcgi.c
index 00d8264..49bf197 100644 (file)
@@ -213,6 +213,16 @@ void FCGI_JSONDouble(const char *key, double value)
        printf(",\r\n\t\"%s\" : %f", key, value);
 }
 
+/**
+ * Similar to FCGI_JsonPair except for boolean values.
+ * @param key The key of the JSON entry
+ * @param value The value associated with the key
+ */
+void FCGI_JSONBool(const char *key, bool value)
+{
+       printf(",\r\n\t\"%s\" : %s", key, value ? "true" : "false");
+}
+
 /**
  * Begins a JSON entry by writing the key. To be used in conjunction
  * with FCGI_JsonValue.
@@ -258,7 +268,7 @@ void FCGI_RejectJSON(FCGIContext *context)
        FCGI_BeginJSON(context, STATUS_ERROR);
        FCGI_JSONPair("description", "Invalid request");
        FCGI_JSONLong("responsenumber", context->response_number);
-       FCGI_JSONPair("params", getenv("DOCUMENT_URI_LOCAL"));
+       FCGI_JSONPair("params", getenv("QUERY_STRING"));
        FCGI_JSONPair("host", getenv("SERVER_HOSTNAME"));
        FCGI_JSONPair("user", getenv("REMOTE_USER"));
        FCGI_JSONPair("ip", getenv("REMOTE_ADDR"));

UCC git Repository :: git.ucc.asn.au