@@ -386,8 +386,6 @@ channel_op_res_t channel_set_options(channel_t *this,
channel_curl->header) != CURLE_OK) ||
(curl_easy_setopt(channel_curl->handle, CURLOPT_MAXREDIRS, -1) !=
CURLE_OK) ||
- (curl_easy_setopt(channel_curl->handle, CURLOPT_FOLLOWLOCATION, 1) !=
- CURLE_OK) ||
(curl_easy_setopt(channel_curl->handle, CURLOPT_REDIR_PROTOCOLS,
CURLPROTO_HTTP | CURLPROTO_HTTPS) != CURLE_OK) ||
(curl_easy_setopt(channel_curl->handle,
@@ -403,6 +401,13 @@ channel_op_res_t channel_set_options(channel_t *this,
goto cleanup;
}
+ if ((!channel_data->nofollow) &&
+ (curl_easy_setopt(channel_curl->handle, CURLOPT_FOLLOWLOCATION, 1) !=
+ CURLE_OK)) {
+ result = CHANNEL_EINIT;
+ goto cleanup;
+ }
+
double percent = -INFINITY;
if ((curl_easy_setopt(channel_curl->handle, CURLOPT_PROGRESSFUNCTION,
channel_callback_xferinfo_legacy) != CURLE_OK) ||
@@ -58,6 +58,7 @@ typedef struct {
bool usessl;
bool strictssl;
bool nocheckanswer;
+ bool nofollow;
int (*checkdwl)(void);
struct swupdate_digest *dgst;
char sha1hash[SHA_DIGEST_LENGTH * 2 + 1];
In most cases, a HTTP redirect should be follow to get the data to be retrieved. Some protocols require a logic when a redirect is received, and the automatic logic inside the libcurl library is not sufficient. Ann a "nofollow" flag in the channel configuration data (inverted logic to be compatible with current implementation) to allow to disable the Curl option. Signed-off-by: Stefano Babic <sbabic@denx.de> --- corelib/channel_curl.c | 9 +++++++-- include/channel_curl.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-)