# HG changeset patch # User Ethan Blanton # Date 1167965071 0 # Node ID 96abd13cc0b329c41c8e900aa5bfce2912c1c67c # Parent 21509d8e4e705c5a9f604d15f16ac1881402dfe2 [gaim-migrate @ 18076] Christian Grothoff pointed out that our UPnP code doesn't properly handle relative URLs which are an absolute path -- fixed. committer: Tailor Script diff -r 21509d8e4e70 -r 96abd13cc0b3 libgaim/upnp.c --- a/libgaim/upnp.c Thu Jan 04 23:55:17 2007 +0000 +++ b/libgaim/upnp.c Fri Jan 05 02:44:31 2007 +0000 @@ -341,7 +341,18 @@ tmp = xmlnode_get_data(controlURLNode); if(baseURL && !gaim_str_has_prefix(tmp, "http://") && !gaim_str_has_prefix(tmp, "HTTP://")) { - controlURL = g_strdup_printf("%s%s", baseURL, tmp); + /* Handle absolute paths in a relative URL. This probably + * belongs in util.c. */ + if (tmp[0] == '/') { + size_t length; + const char *path, *start = strstr(baseURL, "://"); + start = start ? start + 3 : baseURL; + path = strchr(start, '/'); + length = path ? path - baseURL : strlen(baseURL); + controlURL = g_strdup_printf("%.*s%s", length, baseURL, tmp); + } else { + controlURL = g_strdup_printf("%s%s", baseURL, tmp); + } g_free(tmp); }else{ controlURL = tmp;