Why don't run this code.....?
- From: eldruida <druidamix gmail com>
- To: libsoup-list gnome org
- Subject: Why don't run this code.....?
- Date: Sun, 3 Jun 2007 08:34:22 +0000
I'm testing c with libsoup for get a web with this code:
/***********************************
* Títol: *
* Autor: *
* Descripció: *
* *
* *
* *
***********************************/
#include<stdio.h>
#include<libsoup/soup.h>
SoupSession *session;
SoupUri *base_uri;
const char *method = SOUP_METHOD_GET;
char *base = "
http://localhost:4080";
int pendent;
static void get_url(const char *url);
static void got_url(SoupMessage *msg,gpointer uri)
{
printf("hello world\n");
getchar();
}
int
main (int argc, char *argv[])
{
g_type_init();
g_thread_init(NULL);
SoupUri *proxy = NULL;
const char *cafile = NULL;
puts(base);
base_uri = soup_uri_new(base);
if(! base_uri)
{
printf("La direcció %s no és vàlida\n",base);
}
session = soup_session_async_new_with_options(
SOUP_SESSION_SSL_CA_FILE,cafile,
SOUP_SESSION_PROXY_URI,proxy,NULL);
get_url(base);
return 0;
}
static void get_url(const char *url)
{
char *url_to_get;
SoupMessage *msg;
url_to_get = g_strdup(url);
msg = soup_message_new("SOUP_METHOD_GET",url_to_get);
soup_message_set_flags(msg,SOUP_MESSAGE_NO_REDIRECT);
pendent++;
soup_session_queue_message(session,msg,got_url,soup_uri_new(url_to_get));
g_free(url_to_get);
}
It will print hello world, but soup_session_queue_message don't call got_url function.
I compile it with: gcc -o foo `pkg-config --cflags --libs libsoup-2.2` foo.c
Anybody can help me?
Thanks.
[Date Prev][
Date Next] [Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]