Re: setting a http proxy in libsoup

I rewrote my own test as following,
the proxy was set correctly but no answer from
please take a look to the code:
main (int argc, char **argv)
    SoupURI *proxy = NULL;
    SoupSession *session;   
    SoupBuffer *b;
    SoupMessage *msg;
    g_thread_init (NULL);
    g_type_init ();
    session = soup_session_sync_new();
    proxy = soup_uri_new  (http://haithem:mypasswd 192 168 1 1:8080);

    if (proxy)
        g_object_set (G_OBJECT (session),
                      SOUP_SESSION_PROXY_URI, proxy,
       printf(" proxy NULL \n");
  * this message works fine since the site is local
  * msg = soup_message_new(SOUP_METHOD_GET,   
  *                        "http://localhost:8080");
   /* this one does not work */

    msg = soup_message_new(SOUP_METHOD_GET,
    soup_session_send_message (session, msg);
    b = soup_message_body_flatten(msg->response_body);
        printf(" response_body : %s\n\n\n\n\n", b->data);
printf("proxy settings: username = %s \n
                        password = %s \n
                        host =     %s \n
                        port %d\n",
        return 0;
any comments please?

On Fri, May 15, 2009 at 6:55 AM, haithem rahmani <haithem rahmani gmail com> wrote:
Hi all,
Sorry I my question was already discussed.
I'm trying to learn how to use libsoup,
I'm using the version 2.26.0
I compiled the get.c test but when runing it as follows:
./get  -p <mylogin>:<mypasswor>@
I got the following error  message
/: 2 Cannot resolve hostname
so I wrote my own test to check that the proxy is correclty set
please find attached the test source code.
the test output is:
 request_body :
 response_body :

proxy settings: username = (null)
password = (null)
host = (null)
port 0
when changing the URL to a local one ,i.e does not need the proxy server I got the response_body filled with the target page content.
could you help me please.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]