Commit c97e5d95 authored by Philipp Schafft's avatar Philipp Schafft 🦁

Cleanup: Remove redundant passing of client's uri

parent e4560e15
Pipeline #303 failed with stage
in 13 seconds
This diff is collapsed.
...@@ -405,7 +405,7 @@ static void fserve_client_destroy(fserve_t *fclient) ...@@ -405,7 +405,7 @@ static void fserve_client_destroy(fserve_t *fclient)
/* client has requested a file, so check for it and send the file. Do not /* client has requested a file, so check for it and send the file. Do not
* refer to the client_t afterwards. return 0 for success, -1 on error. * refer to the client_t afterwards. return 0 for success, -1 on error.
*/ */
int fserve_client_create (client_t *httpclient, const char *path) int fserve_client_create (client_t *httpclient)
{ {
int bytes; int bytes;
struct stat file_buf; struct stat file_buf;
...@@ -421,8 +421,8 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -421,8 +421,8 @@ int fserve_client_create (client_t *httpclient, const char *path)
ice_config_t *config; ice_config_t *config;
FILE *file; FILE *file;
fullpath = util_get_path_from_normalised_uri (path); fullpath = util_get_path_from_normalised_uri(httpclient->uri);
ICECAST_LOG_INFO("checking for file %H (%H)", path, fullpath); ICECAST_LOG_INFO("checking for file %H (%H)", httpclient->uri, fullpath);
if (strcmp (util_get_extension (fullpath), "m3u") == 0) if (strcmp (util_get_extension (fullpath), "m3u") == 0)
m3u_requested = 1; m3u_requested = 1;
...@@ -452,7 +452,7 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -452,7 +452,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
if (m3u_requested && m3u_file_available == 0) if (m3u_requested && m3u_file_available == 0)
{ {
char *sourceuri = strdup (path); char *sourceuri = strdup(httpclient->uri);
char *dot = strrchr(sourceuri, '.'); char *dot = strrchr(sourceuri, '.');
*dot = 0; *dot = 0;
...@@ -476,7 +476,7 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -476,7 +476,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
if (xslt_playlist_requested && xslt_playlist_file_available == 0) if (xslt_playlist_requested && xslt_playlist_file_available == 0)
{ {
xmlDocPtr doc; xmlDocPtr doc;
char *reference = strdup (path); char *reference = strdup(httpclient->uri);
char *eol = strrchr (reference, '.'); char *eol = strrchr (reference, '.');
if (eol) if (eol)
*eol = '\0'; *eol = '\0';
...@@ -554,7 +554,7 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -554,7 +554,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
endpos = 0; endpos = 0;
} }
httpclient->respcode = 206; httpclient->respcode = 206;
type = fserve_content_type (path); type = fserve_content_type(httpclient->uri);
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0, bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
0, 206, NULL, 0, 206, NULL,
type, NULL, type, NULL,
...@@ -584,7 +584,7 @@ int fserve_client_create (client_t *httpclient, const char *path) ...@@ -584,7 +584,7 @@ int fserve_client_create (client_t *httpclient, const char *path)
} }
} }
else { else {
char *type = fserve_content_type(path); char *type = fserve_content_type(httpclient->uri);
httpclient->respcode = 200; httpclient->respcode = 200;
bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0, bytes = util_http_build_header (httpclient->refbuf->data, BUFSIZE, 0,
0, 200, NULL, 0, 200, NULL,
......
...@@ -32,7 +32,7 @@ typedef struct _fserve_t ...@@ -32,7 +32,7 @@ typedef struct _fserve_t
void fserve_initialize(void); void fserve_initialize(void);
void fserve_shutdown(void); void fserve_shutdown(void);
int fserve_client_create(client_t *httpclient, const char *path); int fserve_client_create(client_t *httpclient);
int fserve_add_client (client_t *client, FILE *file); int fserve_add_client (client_t *client, FILE *file);
void fserve_add_client_callback (client_t *client, fserve_callback_t callback, void *arg); void fserve_add_client_callback (client_t *client, fserve_callback_t callback, void *arg);
char *fserve_content_type (const char *path); char *fserve_content_type (const char *path);
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "icecasttypes.h" #include "icecasttypes.h"
typedef void (*module_client_handler_function_t)(module_t *self, client_t *client, const char *uri); typedef void (*module_client_handler_function_t)(module_t *self, client_t *client);
typedef int (*module_setup_handler_t)(module_t *self, void **userdata); typedef int (*module_setup_handler_t)(module_t *self, void **userdata);
typedef struct { typedef struct {
......
...@@ -1022,10 +1022,10 @@ typedef struct _source_xml_tag { ...@@ -1022,10 +1022,10 @@ typedef struct _source_xml_tag {
} source_xml_t; } source_xml_t;
void stats_transform_xslt(client_t *client, const char *uri) void stats_transform_xslt(client_t *client)
{ {
xmlDocPtr doc; xmlDocPtr doc;
char *xslpath = util_get_path_from_normalised_uri(uri); char *xslpath = util_get_path_from_normalised_uri(client->uri);
const char *mount = httpp_get_param(client->parser, "mount"); const char *mount = httpp_get_param(client->parser, "mount");
doc = stats_get_xml(0, mount, client); doc = stats_get_xml(0, mount, client);
......
...@@ -92,7 +92,7 @@ void stats_event_time_iso8601 (const char *mount, const char *name); ...@@ -92,7 +92,7 @@ void stats_event_time_iso8601 (const char *mount, const char *name);
void *stats_connection(void *arg); void *stats_connection(void *arg);
void stats_callback (client_t *client, void *notused); void stats_callback (client_t *client, void *notused);
void stats_transform_xslt(client_t *client, const char *uri); void stats_transform_xslt(client_t *client);
void stats_sendxml(client_t *client); void stats_sendxml(client_t *client);
xmlDocPtr stats_get_xml(int show_hidden, const char *show_mount, client_t *client); xmlDocPtr stats_get_xml(int show_hidden, const char *show_mount, client_t *client);
char *stats_get_value(const char *source, const char *name); char *stats_get_value(const char *source, const char *name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment