summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-02-08 23:00:21 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-02-08 23:01:21 +0100
commit496c59e5ec47db59aff443d6b4be2645f7504b93 (patch)
tree76b4a74c5d1e9f6f27cefc01cedf10b1d8f010f1
parent0c51036eb6ddef50a1730bdd33a4388b35343125 (diff)
downloadcurl-bagder/urldata-redirect-counter.tar.gz
urldata: move 'followlocation' to UrlStatebagder/urldata-redirect-counter
As this is a state variable it does not belong in UserDefined which is used to store values set by the user.
-rw-r--r--lib/getinfo.c4
-rw-r--r--lib/transfer.c6
-rw-r--r--lib/urldata.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index 67ea07d2e..f531631b8 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -235,7 +235,7 @@ static CURLcode getinfo_long(struct Curl_easy *data, CURLINFO info,
break;
#endif
case CURLINFO_REDIRECT_COUNT:
- *param_longp = data->set.followlocation;
+ *param_longp = data->state.followlocation;
break;
case CURLINFO_HTTPAUTH_AVAIL:
lptr.to_long = param_longp;
diff --git a/lib/transfer.c b/lib/transfer.c
index 2f29b29d8..59f759600 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1426,7 +1426,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
return result;
data->state.wildcardmatch = data->set.wildcard_enabled;
- data->set.followlocation = 0; /* reset the location-follow counter */
+ data->state.followlocation = 0; /* reset the location-follow counter */
data->state.this_is_a_follow = FALSE; /* reset this */
data->state.errorbuf = FALSE; /* no error has occurred */
data->state.httpversion = 0; /* don't assume any particular server version */
@@ -1553,7 +1553,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
if(type == FOLLOW_REDIR) {
if((data->set.maxredirs != -1) &&
- (data->set.followlocation >= data->set.maxredirs)) {
+ (data->state.followlocation >= data->set.maxredirs)) {
reachedmax = TRUE;
type = FOLLOW_FAKE; /* switch to fake to store the would-be-redirected
to URL */
@@ -1562,7 +1562,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
/* mark the next request as a followed location: */
data->state.this_is_a_follow = TRUE;
- data->set.followlocation++; /* count location-followers */
+ data->state.followlocation++; /* count location-followers */
if(data->set.http_auto_referer) {
/* We are asked to automatically set the previous URL as the referer
diff --git a/lib/urldata.h b/lib/urldata.h
index 0d03cf11c..c2f3128d2 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1337,6 +1337,7 @@ struct UrlState {
unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
int os_errno; /* filled in with errno whenever an error occurs */
char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
+ long followlocation; /* redirect counter */
#ifdef HAVE_SIGNAL
/* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
void (*prev_signal)(int sig);
@@ -1619,7 +1620,6 @@ struct UserDefined {
unsigned long httpauth; /* kind of HTTP authentication to use (bitmask) */
unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */
unsigned long socks5auth;/* kind of SOCKS5 authentication to use (bitmask) */
- long followlocation; /* as in HTTP Location: */
long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
for infinity */