Mercurial > pidgin
changeset 6128:3de23c9ca1e4
[gaim-migrate @ 6602]
Fixed HTTP redirect handling. If a redirect specified a path without a URL
(as is often the case), our redirect handling would crash and burn. Now it
only skids along the ground and manages to save itself and retrieve the
file. Think Indiana Jones, but with HTTP redirects and giant smileys.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Tue, 15 Jul 2003 03:03:02 +0000 |
parents | 2ecab9e88b97 |
children | 1d9a0532df1a |
files | src/html.c |
diffstat | 1 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/html.c Tue Jul 15 03:00:24 2003 +0000 +++ b/src/html.c Tue Jul 15 03:03:02 2003 +0000 @@ -129,7 +129,8 @@ gchar *s; if ((s = g_strstr_len(data, data_len, "Location: ")) != NULL) { - gchar *new_url, *end; + gchar *new_url, *temp_url, *end; + gboolean full; int len; s += strlen("Location: "); @@ -145,13 +146,28 @@ strncpy(new_url, s, len); new_url[len] = '\0'; + full = gunk->full; + + if (*new_url == '/' || g_strstr_len(new_url, len, "://") == NULL) { + temp_url = new_url; + + new_url = g_strdup_printf("%s:%d%s", gunk->website->address, + gunk->website->port, temp_url); + + g_free(temp_url); + + full = FALSE; + } + /* Close the existing stuff. */ gaim_input_remove(gunk->inpa); close(sock); + gaim_debug(GAIM_DEBUG_INFO, "grab_url", + "Redirecting to %s\n", new_url); + /* Try again, with this new location. */ - grab_url(new_url, gunk->full, gunk->callback, - gunk->data); + grab_url(new_url, full, gunk->callback, gunk->data); /* Free up. */ g_free(new_url);