Fix the redirect counter
This commit is contained in:
parent
bf54ebef7e
commit
0f7e8cdb8c
|
@ -97,7 +97,6 @@ gemini_reset(struct gemini *g)
|
|||
g->reqlen = 0;
|
||||
g->index = 0;
|
||||
g->state = GEMINI_STATE_INIT;
|
||||
g->redirects = 0;
|
||||
g->status = 0;
|
||||
if (g->port == 0)
|
||||
g->port = GEMINI_DEFAULT_PORT;
|
||||
|
@ -341,6 +340,8 @@ gemini_read(struct gemini *g, void *b, size_t bs)
|
|||
}
|
||||
i = j + 2;
|
||||
}
|
||||
if (g->status / 10 != 3)
|
||||
g->redirects = 0;
|
||||
switch (g->status / 10) {
|
||||
case 0:
|
||||
goto errinval;
|
||||
|
@ -355,7 +356,8 @@ gemini_read(struct gemini *g, void *b, size_t bs)
|
|||
if (g->redirects >= g->maxredirects)
|
||||
goto errredir;
|
||||
g->redirects++;
|
||||
if (gemini_connect_query(g, g->meta, NULL) != 0)
|
||||
if (gemini_connect_query(g, g->meta,
|
||||
NULL) != 0)
|
||||
goto err;
|
||||
return (gemini_read(g, b, bs));
|
||||
case 4:
|
||||
|
|
Loading…
Reference in New Issue