From add330fbacbc69afa20d933a2111109227807687 Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Fri, 22 Jun 2012 23:20:16 +0900
Subject: [PATCH 1/2] Metalink: ignore --include if --metalink is used.

Including headers in response body will break Metalink XML parser.
If it is included in the file described in Metalink XML, hash check
will fail. Therefore, --include should be ignored if --metalink is
used.
---
 src/tool_operate.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/tool_operate.c b/src/tool_operate.c
index 3fcdf47..e5b06a7 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -879,7 +879,10 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
           my_setopt(curl, CURLOPT_NOBODY, 1);
           my_setopt(curl, CURLOPT_HEADER, 1);
         }
-        else
+        /* If --metalink is used, we ignore --headers option because
+           mixing headers to the body will confuse XML parser and/or
+           hash check will fail. */
+        else if(!config->use_metalink)
           my_setopt(curl, CURLOPT_HEADER, config->include_headers);
 
 #if !defined(CURL_DISABLE_PROXY)
-- 
1.7.9.1

