Commit 96736bd0 authored by brendan's avatar brendan

Make new ice-audio-info header use ; instead of & as delimiter, like RTSP headers

sometimes do. Compare:

ice-audio-header: bitrate=128;samplerate=44100;channels=2
to
Transport: RTP/AVP/UDP;unicast;client_port=3058-3059;server_port=5002-5003

Isn't it pretty?

This one's for you, Jack.

svn path=/trunk/libshout/; revision=4362
parent e5ca11ca
......@@ -240,7 +240,7 @@ int shout_set_metadata(shout_t *self, shout_metadata_t *metadata)
if (!self || !metadata)
return SHOUTERR_INSANE;
if (!(encvalue = util_dict_urlencode(metadata)))
if (!(encvalue = util_dict_urlencode(metadata, '&')))
return SHOUTERR_MALLOC;
if (!self->connected)
......@@ -712,7 +712,7 @@ static int send_http_request(shout_t *self, char *username, char *password)
if (bitrate && !sock_write(self->socket, "ice-bitrate: %s\r\n", bitrate))
return SHOUTERR_SOCKET;
#else
if (ai = util_dict_urlencode(self->audio_info)) {
if (ai = util_dict_urlencode(self->audio_info, ';')) {
if (!sock_write(self->socket, "ice-audio-info: %s\r\n", ai)) {
free(ai);
return SHOUTERR_SOCKET;
......
......@@ -199,7 +199,7 @@ int util_dict_set(util_dict *dict, const char *key, const char *val)
/* given a dictionary, URL-encode each key and val and stringify them in order as
key=val&key=val... if val is set, or just key&key if val is NULL.
TODO: Memory management needs overhaul. */
char *util_dict_urlencode(util_dict *dict)
char *util_dict_urlencode(util_dict *dict, char delim)
{
char *res, *tmp;
char *enc;
......@@ -229,7 +229,7 @@ char *util_dict_urlencode(util_dict *dict)
return NULL;
} else
res = tmp;
sprintf(res + strlen(res), "&%s", enc);
sprintf(res + strlen(res), "%c%s", delim, enc);
free(enc);
}
......
......@@ -18,7 +18,7 @@ void util_dict_free(util_dict *dict);
/* dict, key must not be NULL. */
int util_dict_set(util_dict *dict, const char *key, const char *val);
const char *util_dict_get(util_dict *dict, const char *key);
char *util_dict_urlencode(util_dict *dict);
char *util_dict_urlencode(util_dict *dict, char delim);
char *util_base64_encode(char *data);
char *util_url_encode(const char *data);
......
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