From 966fa848a0213be52d3a4b3787c36ec7c5553f22 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 27 Oct 2005 22:05:38 +0000 Subject: Nis Jorgensen filed bug report #1338648 (http://curl.haxx.se/bug/view.cgi?id=1338648) which really is more of a feature request, but anyway. It pointed out that --max-redirs did not allow it to be set to 0, which then would return an error code on the first Location: found. Based on Nis' patch, now libcurl supports CURLOPT_MAXREDIRS set to 0, or -1 for infinity. Added test case 274 to verify. --- src/main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 33200cea0..99edc61d7 100644 --- a/src/main.c +++ b/src/main.c @@ -3211,6 +3211,7 @@ operate(struct Configurable *config, int argc, char *argv[]) config->create_dirs=FALSE; config->lastrecvtime = curlx_tvnow(); config->lastsendtime = curlx_tvnow(); + config->maxredirs = DEFAULT_MAXREDIRS; if(argc>1 && (!curlx_strnequal("--", argv[1], 2) && (argv[1][0] == '-')) && @@ -3803,11 +3804,7 @@ operate(struct Configurable *config, int argc, char *argv[]) curl_easy_setopt(curl, CURLOPT_FILETIME, TRUE); } - if (config->maxredirs) - curl_easy_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs); - else - curl_easy_setopt(curl, CURLOPT_MAXREDIRS, DEFAULT_MAXREDIRS); - + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs); curl_easy_setopt(curl, CURLOPT_CRLF, config->crlf); curl_easy_setopt(curl, CURLOPT_QUOTE, config->quote); curl_easy_setopt(curl, CURLOPT_POSTQUOTE, config->postquote); -- cgit v1.2.3