Commit 4e69f554 authored by Philipp Schafft's avatar Philipp Schafft 🦁
Browse files

Feature: Make the message header configurable

parent 8a08ae25
...@@ -105,6 +105,7 @@ typedef struct { ...@@ -105,6 +105,7 @@ typedef struct {
/* new style */ /* new style */
char *header_auth; char *header_auth;
char *header_timelimit; char *header_timelimit;
char *header_message;
char *userpwd; char *userpwd;
CURL *handle; CURL *handle;
...@@ -138,6 +139,7 @@ static void auth_url_clear(auth_t *self) ...@@ -138,6 +139,7 @@ static void auth_url_clear(auth_t *self)
free(url->timelimit_header); free(url->timelimit_header);
free(url->header_auth); free(url->header_auth);
free(url->header_timelimit); free(url->header_timelimit);
free(url->header_message);
free(url->userpwd); free(url->userpwd);
free(url); free(url);
} }
...@@ -211,9 +213,13 @@ static void handle_returned_header__complete(auth_client *auth_user) ...@@ -211,9 +213,13 @@ static void handle_returned_header__complete(auth_client *auth_user)
} }
} }
tmp = httpp_getvar(au_url->parser, DEFAULT_HEADER_NEW_MESSAGE); if (url->header_message) {
if (!tmp) tmp = httpp_getvar(au_url->parser, url->header_message);
tmp = httpp_getvar(au_url->parser, DEFAULT_HEADER_OLD_MESSAGE); } else {
tmp = httpp_getvar(au_url->parser, DEFAULT_HEADER_NEW_MESSAGE);
if (!tmp)
tmp = httpp_getvar(au_url->parser, DEFAULT_HEADER_OLD_MESSAGE);
}
if (tmp) { if (tmp) {
snprintf(url->errormsg, sizeof(url->errormsg), "%s", tmp); snprintf(url->errormsg, sizeof(url->errormsg), "%s", tmp);
} }
...@@ -597,6 +603,8 @@ int auth_get_url_auth(auth_t *authenticator, config_options_t *options) ...@@ -597,6 +603,8 @@ int auth_get_url_auth(auth_t *authenticator, config_options_t *options)
replace_string(&(url_info->header_auth), options->value); replace_string(&(url_info->header_auth), options->value);
} else if (strcmp(options->name, "header_timelimit") == 0) { } else if (strcmp(options->name, "header_timelimit") == 0) {
replace_string(&(url_info->header_timelimit), options->value); replace_string(&(url_info->header_timelimit), options->value);
} else if (strcmp(options->name, "header_message") == 0) {
replace_string(&(url_info->header_message), options->value);
} else { } else {
ICECAST_LOG_ERROR("Unknown option: %s", options->name); ICECAST_LOG_ERROR("Unknown option: %s", options->name);
} }
......
Supports Markdown
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