mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 16:48:49 -05:00
urldata: move 'followlocation' to UrlState
As this is a state variable it does not belong in UserDefined which is used to store values set by the user. Closes #6582
This commit is contained in:
parent
13d8a56408
commit
f1e5e49879
@ -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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* 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;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case CURLINFO_REDIRECT_COUNT:
|
case CURLINFO_REDIRECT_COUNT:
|
||||||
*param_longp = data->set.followlocation;
|
*param_longp = data->state.followlocation;
|
||||||
break;
|
break;
|
||||||
case CURLINFO_HTTPAUTH_AVAIL:
|
case CURLINFO_HTTPAUTH_AVAIL:
|
||||||
lptr.to_long = param_longp;
|
lptr.to_long = param_longp;
|
||||||
|
@ -1426,7 +1426,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
data->state.wildcardmatch = data->set.wildcard_enabled;
|
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.this_is_a_follow = FALSE; /* reset this */
|
||||||
data->state.errorbuf = FALSE; /* no error has occurred */
|
data->state.errorbuf = FALSE; /* no error has occurred */
|
||||||
data->state.httpversion = 0; /* don't assume any particular server version */
|
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(type == FOLLOW_REDIR) {
|
||||||
if((data->set.maxredirs != -1) &&
|
if((data->set.maxredirs != -1) &&
|
||||||
(data->set.followlocation >= data->set.maxredirs)) {
|
(data->state.followlocation >= data->set.maxredirs)) {
|
||||||
reachedmax = TRUE;
|
reachedmax = TRUE;
|
||||||
type = FOLLOW_FAKE; /* switch to fake to store the would-be-redirected
|
type = FOLLOW_FAKE; /* switch to fake to store the would-be-redirected
|
||||||
to URL */
|
to URL */
|
||||||
@ -1562,7 +1562,7 @@ CURLcode Curl_follow(struct Curl_easy *data,
|
|||||||
/* mark the next request as a followed location: */
|
/* mark the next request as a followed location: */
|
||||||
data->state.this_is_a_follow = TRUE;
|
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) {
|
if(data->set.http_auto_referer) {
|
||||||
/* We are asked to automatically set the previous URL as the referer
|
/* We are asked to automatically set the previous URL as the referer
|
||||||
|
@ -1337,6 +1337,7 @@ struct UrlState {
|
|||||||
unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
|
unsigned int tempcount; /* number of entries in use in tempwrite, 0 - 3 */
|
||||||
int os_errno; /* filled in with errno whenever an error occurs */
|
int os_errno; /* filled in with errno whenever an error occurs */
|
||||||
char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
|
char *scratch; /* huge buffer[set.buffer_size*2] for upload CRLF replacing */
|
||||||
|
long followlocation; /* redirect counter */
|
||||||
#ifdef HAVE_SIGNAL
|
#ifdef HAVE_SIGNAL
|
||||||
/* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
|
/* storage for the previous bag^H^H^HSIGPIPE signal handler :-) */
|
||||||
void (*prev_signal)(int sig);
|
void (*prev_signal)(int sig);
|
||||||
@ -1619,7 +1620,6 @@ struct UserDefined {
|
|||||||
unsigned long httpauth; /* kind of HTTP authentication to use (bitmask) */
|
unsigned long httpauth; /* kind of HTTP authentication to use (bitmask) */
|
||||||
unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */
|
unsigned long proxyauth; /* kind of proxy authentication to use (bitmask) */
|
||||||
unsigned long socks5auth;/* kind of SOCKS5 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
|
long maxredirs; /* maximum no. of http(s) redirects to follow, set to -1
|
||||||
for infinity */
|
for infinity */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user