curl-library
curl send wrong data ?
Date: Fri, 4 Jun 2004 14:57:43 +0200
Hi all. I have one problem. I want to send data to the web page. And works but
it send wrong data. Here is the code :
static gint timeout_func(gpointer data)
{
int pos, length, rate, freq, nch;
char *src;
char *str;
char *url;
char *tit;
char *art;
char *kbps;
char *shstring = NULL;
char *temp, numbuf[16];
gboolean playing, run_end_cmd = FALSE;
static char *previous_file;
char *current_file;
playing = xmms_remote_is_playing(sc_gp.xmms_session);
pos = xmms_remote_get_playlist_pos(sc_gp.xmms_session);
current_file = xmms_remote_get_playlist_file(sc_gp.xmms_session, pos);
CURL *curl;
CURLcode res;
if (pos != previous_song ||
(!previous_file && current_file) ||
(previous_file && !current_file) ||
(previous_file && current_file &&
strcmp(previous_file, current_file)))
{
g_free(previous_file);
previous_file = current_file;
current_file = NULL;
previous_song = pos;
char* url = malloc((strlen(url) + strlen(str), sizeof(char)));
curl = curl_easy_init();
str = xmms_remote_get_playlist_title(sc_gp.xmms_session,pos);
sprintf(url,
"planet-si.net/addsong.php?action=add&art=%s&tit=test&time=2:21&kbps=320",str);
//curl_unescape(url,0);
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL,url);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
free(url);
}
}
The data which is send is (log from Apache) :
10.0.0.20 - - [04/Jun/2004:14:54:58 +0200] "GET /ad\x80\xe95\b \x9a\x81(\x07
HTTP/1.1" 404 293 and so on.
Sometimes sends right url but almots all the time the data is corrupted. Where
is the problem ? :/
Thanks
--Received on 2004-06-04