Mercurial > pidgin.yaz
comparison libgaim/upnp.c @ 15287:96abd13cc0b3
[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 <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Fri, 05 Jan 2007 02:44:31 +0000 |
parents | 192c66c0c2cb |
children |
comparison
equal
deleted
inserted
replaced
15286:21509d8e4e70 | 15287:96abd13cc0b3 |
---|---|
339 } | 339 } |
340 | 340 |
341 tmp = xmlnode_get_data(controlURLNode); | 341 tmp = xmlnode_get_data(controlURLNode); |
342 if(baseURL && !gaim_str_has_prefix(tmp, "http://") && | 342 if(baseURL && !gaim_str_has_prefix(tmp, "http://") && |
343 !gaim_str_has_prefix(tmp, "HTTP://")) { | 343 !gaim_str_has_prefix(tmp, "HTTP://")) { |
344 controlURL = g_strdup_printf("%s%s", baseURL, tmp); | 344 /* Handle absolute paths in a relative URL. This probably |
345 * belongs in util.c. */ | |
346 if (tmp[0] == '/') { | |
347 size_t length; | |
348 const char *path, *start = strstr(baseURL, "://"); | |
349 start = start ? start + 3 : baseURL; | |
350 path = strchr(start, '/'); | |
351 length = path ? path - baseURL : strlen(baseURL); | |
352 controlURL = g_strdup_printf("%.*s%s", length, baseURL, tmp); | |
353 } else { | |
354 controlURL = g_strdup_printf("%s%s", baseURL, tmp); | |
355 } | |
345 g_free(tmp); | 356 g_free(tmp); |
346 }else{ | 357 }else{ |
347 controlURL = tmp; | 358 controlURL = tmp; |
348 } | 359 } |
349 g_free(baseURL); | 360 g_free(baseURL); |