int xslt_client (client_t *client) { xsl_req *x = client->shared_data; int ret = xslt_transform (x->doc, x->cache.filename, client); free (x->cache.filename); free (x); return ret; }
void stats_transform_xslt(client_t *client, char *xslpath) { xmlDocPtr doc; stats_get_xml(&doc); xslt_transform(doc, xslpath, client); xmlFreeDoc(doc); }
void stats_transform_xslt(client_t *client, const char *uri) { xmlDocPtr doc; char *xslpath = util_get_path_from_normalised_uri (uri); stats_get_xml(&doc, 0); xslt_transform(doc, xslpath, client); xmlFreeDoc(doc); free (xslpath); }
void stats_transform_xslt(client_t *client, const char *uri) { xmlDocPtr doc; char *xslpath = util_get_path_from_normalised_uri(uri); const char *mount = httpp_get_query_param(client->parser, "mount"); doc = stats_get_xml(0, mount, client->mode); xslt_transform(doc, xslpath, client); xmlFreeDoc(doc); free(xslpath); }
int stats_transform_xslt (client_t *client, const char *uri) { xmlDocPtr doc; char *xslpath = util_get_path_from_normalised_uri (uri, 0); const char *mount = httpp_get_query_param (client->parser, "mount"); int ret; if (mount == NULL && client->server_conn->shoutcast_mount && strcmp (uri, "/7.xsl") == 0) mount = client->server_conn->shoutcast_mount; doc = stats_get_xml (STATS_PUBLIC, mount); ret = xslt_transform (doc, xslpath, client); xmlFreeDoc(doc); free (xslpath); return ret; }
int admin_send_response (xmlDocPtr doc, client_t *client, admin_response_type response, const char *xslt_template) { int ret = -1; if (response == RAW) { xmlChar *buff = NULL; int len = 0; unsigned int buf_len; const char *http = "HTTP/1.0 200 OK\r\n" "Content-Type: text/xml\r\n" "Content-Length: "; xmlDocDumpFormatMemoryEnc (doc, &buff, &len, NULL, 1); buf_len = strlen (http) + len + 20; client_set_queue (client, NULL); client->refbuf = refbuf_new (buf_len); len = snprintf (client->refbuf->data, buf_len, "%s%d\r\n\r\n%s", http, len, buff); client->refbuf->len = len; xmlFree(buff); xmlFreeDoc (doc); client->respcode = 200; return fserve_setup_client (client); } if (response == XSLT) { char *fullpath_xslt_template; int fullpath_xslt_template_len; ice_config_t *config = config_get_config(); fullpath_xslt_template_len = strlen (config->adminroot_dir) + strlen(xslt_template) + 2; fullpath_xslt_template = malloc(fullpath_xslt_template_len); snprintf(fullpath_xslt_template, fullpath_xslt_template_len, "%s%s%s", config->adminroot_dir, PATH_SEPARATOR, xslt_template); config_release_config(); DEBUG1("Sending XSLT (%s)", fullpath_xslt_template); ret = xslt_transform (doc, fullpath_xslt_template, client); free(fullpath_xslt_template); xmlFreeDoc(doc); } return ret; }
void admin_send_response(xmlDocPtr doc, client_t *client, int response, char *xslt_template) { xmlChar *buff = NULL; int len = 0; ice_config_t *config; char *fullpath_xslt_template; int fullpath_xslt_template_len; char *adminwebroot; client->respcode = 200; if (response == RAW) { xmlDocDumpMemory(doc, &buff, &len); html_write(client, "HTTP/1.0 200 OK\r\n" "Content-Length: %d\r\n" "Content-Type: text/xml\r\n" "\r\n", len); html_write(client, "%s", buff); } if (response == TRANSFORMED) { config = config_get_config(); adminwebroot = config->adminroot_dir; fullpath_xslt_template_len = strlen(adminwebroot) + strlen(xslt_template) + 2; fullpath_xslt_template = malloc(fullpath_xslt_template_len); snprintf(fullpath_xslt_template, fullpath_xslt_template_len, "%s%s%s", adminwebroot, PATH_SEPARATOR, xslt_template); config_release_config(); html_write(client, "HTTP/1.0 200 OK\r\n" "Content-Type: text/html\r\n" "\r\n"); DEBUG1("Sending XSLT (%s)", fullpath_xslt_template); xslt_transform(doc, fullpath_xslt_template, client); free(fullpath_xslt_template); } if (buff) { xmlFree(buff); } }
int xslt_client (client_t *client) { xsl_req *x = client->shared_data; // DEBUG1 ("delayed update for %s, trying to update now", x->cache.filename); return xslt_transform (x->doc, x->cache.filename, client); }