+/**
+ * To be used when the input parameters are invalid. The return data will
+ * have a status of STATUS_ERROR, along with other debugging information.
+ * @param context The context to work in
+ */
+void FCGI_RejectJSON(FCGIContext *context)
+{
+ FCGI_RejectJSONEx(context, STATUS_ERROR, "Invalid request");
+}
+
+/**
+ * To be used when the input parameters are rejected. The return data
+ * will also have debugging information provided.
+ * @param context The context to work in
+ * @param status The status the return data should have.
+ * @param description A short description of why the input was rejected.
+ */
+void FCGI_RejectJSONEx(FCGIContext *context, StatusCodes status, const char *description)
+{
+ if (description == NULL)
+ description = "Unknown";
+
+ Log(LOGINFO, "%s: Rejected query with: %d: %s", context->current_module, status, description);
+ FCGI_BeginJSON(context, status);
+ FCGI_JSONPair("description", description);
+ FCGI_JSONLong("responsenumber", context->response_number);
+ FCGI_JSONPair("params", getenv("QUERY_STRING"));
+ FCGI_JSONPair("host", getenv("SERVER_HOSTNAME"));
+ FCGI_JSONPair("user", getenv("REMOTE_USER"));
+ FCGI_JSONPair("ip", getenv("REMOTE_ADDR"));
+ FCGI_EndJSON();
+}
+
+/**
+ * Generates a response to the client as described by the format parameter and
+ * extra arguments (exactly like printf). To be used when none of the other
+ * predefined functions will work exactly as needed. Extra care should be taken
+ * to ensure the correctness of the output.
+ * @param format The format string
+ * @param ... Any extra arguments as required by the format string.
+ */
+void FCGI_PrintRaw(const char *format, ...)
+{
+ va_list list;
+ va_start(list, format);
+ vprintf(format, list);
+ va_end(list);
+}
+