Cookies for localhost only using domain=127.0.0.1 with libsoup

Hi,
I just implemented a prototype of an XMLRPC server using libsoup. Read more on Savannah.

Now, I face a problem to set cookies for domain=localhost. Since the domain name has to include a dot, I did this as a workaround:

    if(strchr(server->domain, '.') == NULL){
      domain = server->ip4;
    }else{
      domain = server->domain;
    }

    path = "/";
    
    /* response */
    login_cookie = soup_cookie_new("ags-srv-login",
				   username,
				   domain,
				   path,
				   -1);

But I am not happy with it because there might be no IPv4 address at all, if it uses IPv6 I have the same problem as with local domains.

How would you fix this issue? What about omitting domain and path?

best regards,
Joël

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.