From 9c9028cfb8a96500c4cffdafe586e3cd1eb2ef86 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sat, 26 Mar 2016 22:33:14 +0100 Subject: [PATCH] src/wget.c (_get_header): Do not store metalink files Signed-off-by: Giuseppe Scrivano --- src/wget.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/wget.c b/src/wget.c index e2e7cfc3..7d211c38 100644 --- a/src/wget.c +++ b/src/wget.c @@ -2229,7 +2229,15 @@ static int _get_header(void *context, wget_http_response_t *resp) struct _body_callback_context *ctx = (struct _body_callback_context *)context; const char *dest = NULL; - if (ctx->head) + bool metalink = false; + + if (resp->content_type + && (!wget_strcasecmp_ascii(resp->content_type, "application/metalink4+xml") || + !wget_strcasecmp_ascii(resp->content_type, "application/metalink+xml"))) { + metalink = true; + } + + if (ctx->head || metalink) dest = NULL; else if (ctx->part) { ctx->outfd = open(ctx->downloader->job->metalink->name, O_WRONLY | O_CREAT, 0644);