aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Obergrusberger <tradiaz@yahoo.de>2008-01-18 13:53:06 +0000
committerAndreas Obergrusberger <tradiaz@yahoo.de>2008-01-18 13:53:06 +0000
commit3911da5c6169877988b061d1de9b475f5789ba69 (patch)
tree6aed0698734cb4af5cec440c65729e67fa833354 /src
parent6e4eecb69c8a23b4489aa8a1a44a9351f2220a0c (diff)
downloadmpd-3911da5c6169877988b061d1de9b475f5789ba69.tar.gz
mpd-3911da5c6169877988b061d1de9b475f5789ba69.tar.xz
mpd-3911da5c6169877988b061d1de9b475f5789ba69.zip
improve escaping of URLs
git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@7141 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/lyrics_leoslyrics.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lyrics_leoslyrics.c b/src/lyrics_leoslyrics.c
index 4afb3fa7b..99dac9dde 100644
--- a/src/lyrics_leoslyrics.c
+++ b/src/lyrics_leoslyrics.c
@@ -95,13 +95,14 @@ static void fetch_text(void *userData, const XML_Char *s, int len)
int check_lyr_leoslyrics(char *artist, char *title, char *url)
{
char url_avail[256];
+ CURL *curl = curl_easy_init ();
+
//this replacess the whitespaces with '+'
- g_strdelimit(artist, " ", '+');
- g_strdelimit(title, " ", '+');
-
+ char *esc_title = curl_easy_escape (curl, title, 0);
+ char *esc_artist = curl_easy_escape (curl, artist, 0);
//we insert the artist and the title into the url
- snprintf(url_avail, 512, LEOSLYRICS_SEARCH_URL, artist, title);
+ snprintf(url_avail, 512, LEOSLYRICS_SEARCH_URL, esc_artist, esc_title);
//download that xml!
easy_download_struct lyr_avail = {NULL, 0,-1};
@@ -121,7 +122,6 @@ int check_lyr_leoslyrics(char *artist, char *title, char *url)
if(!(result & 4)) return -1; //check whether lyrics found
- CURL *curl = curl_easy_init ();
char *esc_hid = curl_easy_escape (curl, hid, 0);
free (hid);