diff --git a/src/recur.c b/src/recur.c index b6b9dc6a9c..ea39c81792 100644 --- a/src/recur.c +++ b/src/recur.c @@ -118,12 +118,23 @@ url_enqueue (struct url_queue *queue, struct iri *i, DEBUGP (("[IRI Enqueuing %s with %s\n", quote_n (0, url), i->uri_encoding ? quote_n (1, i->uri_encoding) : "None")); - if (queue->tail) - queue->tail->next = qel; - queue->tail = qel; + if (html_allowed) + { + if (queue->tail) + queue->tail->next = qel; + queue->tail = qel; + } + else + { + if (queue->head) + qel->next = queue->head; + queue->head = qel; + } if (!queue->head) queue->head = queue->tail; + if (!queue->tail) + queue->tail = queue->head; } /* Take a URL out of the queue. Return true if this operation