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.
This commit is contained in:
Daniel Stenberg
2005-10-27 22:05:38 +00:00
parent 6f8fe67ace
commit 966fa848a0
9 changed files with 72 additions and 12 deletions

View File

@@ -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);