Skip to content

Commit

Permalink
fix repeated guppy:// redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Apr 13, 2024
1 parent ef90f35 commit ce6e44a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions guppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ static void *guppy_download(const Selector *sel, URL *url, char **mime, Parser *
(void)sel;

if ((s = malloc(sizeof(GuppySocket))) == NULL) return NULL;
if ((s->fd = socket_connect(url, SOCK_DGRAM)) == -1) { free(s); return NULL; }
s->last = -1;
s->fd = s->last = -1;
LIST_INIT(&s->chunks);

do {
if (s->fd != -1) close(s->fd);
if ((s->fd = socket_connect(url, SOCK_DGRAM)) == -1) { guppy_close(s); return NULL; }
status = do_guppy_download(url, s, mime, ask);
/* stop on success, on error or when the redirect limit is exhausted */
if (status > 5) break;
Expand Down

0 comments on commit ce6e44a

Please sign in to comment.