static struct HostSet *builder;
+/**
+ * Add headers to a request indicating that we allow Cross-Origin Resource
+ * Sharing.
+ *
+ * @param response response to add headers to
+ */
+static void
+add_cors_headers (struct MHD_Response *response)
+{
+ MHD_add_response_header (response,
+ "Access-Control-Allow-Origin",
+ "*");
+ MHD_add_response_header (response,
+ "Access-Control-Allow-Methods",
+ "GET, OPTIONS");
+ MHD_add_response_header (response,
+ "Access-Control-Max-Age",
+ "86400");
+}
+
+
/**
* Function that assembles our response.
*/
response =
MHD_create_response_from_data (builder->size, builder->data, MHD_YES,
MHD_NO);
+ add_cors_headers (response);
if ((NULL == daemon_handle_v4) && (NULL == daemon_handle_v6))
{
MHD_destroy_response (response);
}
-/**
- * Add headers to a request indicating that we allow Cross-Origin Resource
- * Sharing.
- *
- * @param response response to add headers to
- */
-static void
-add_cors_headers (struct MHD_Response *response)
-{
- MHD_add_response_header (response,
- "Access-Control-Allow-Origin",
- "*");
- MHD_add_response_header (response,
- "Access-Control-Allow-Methods",
- "GET, OPTIONS");
- MHD_add_response_header (response,
- "Access-Control-Max-Age",
- "86400");
-}
-
-
/**
* Main request handler.
*