diff options
author | Daniel Stenberg <daniel@haxx.se> | 2005-10-27 22:05:38 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2005-10-27 22:05:38 +0000 |
commit | 966fa848a0213be52d3a4b3787c36ec7c5553f22 (patch) | |
tree | 113fe21384b7289127ac36f3cfb501dd6ee0571f /lib | |
parent | 6f8fe67ace4346c3c22fb3348d54ba1cfeb59669 (diff) |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/transfer.c | 2 | ||||
-rw-r--r-- | lib/url.c | 2 | ||||
-rw-r--r-- | lib/urldata.h | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index 13f31e9bc..1706ccb6f 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1765,7 +1765,7 @@ CURLcode Curl_follow(struct SessionHandle *data, size_t newlen; char *newest; - if (data->set.maxredirs && + if ((data->set.maxredirs != -1) && (data->set.followlocation >= data->set.maxredirs)) { failf(data,"Maximum (%d) redirects followed", data->set.maxredirs); return CURLE_TOO_MANY_REDIRECTS; @@ -320,7 +320,7 @@ CURLcode Curl_open(struct SessionHandle **curl) data->set.infilesize = -1; /* we don't know any size */ data->set.postfieldsize = -1; - + data->set.maxredirs = -1; /* allow any amount by default */ data->state.current_speed = -1; /* init to negative == impossible */ data->set.httpreq = HTTPREQ_GET; /* Default HTTP request */ diff --git a/lib/urldata.h b/lib/urldata.h index 87a751f6f..b5b2d8040 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -956,7 +956,8 @@ struct UserDefined { char *set_range; /* range, if used. See README for detailed specification on this syntax. */ long followlocation; /* as in HTTP Location: */ - long maxredirs; /* maximum no. of http(s) redirects to follow */ + long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1 + for infinity */ char *set_referer; /* custom string */ bool free_referer; /* set TRUE if 'referer' points to a string we allocated */ |