aboutsummaryrefslogtreecommitdiff
path: root/lib/getinfo.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-04-30 21:20:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-04-30 21:20:08 +0000
commit852989856d3802a9e7bd2f1e368302d92ddf66e2 (patch)
treec26ddf2fbf798b3939f0867bff7b90dfdcde0148 /lib/getinfo.c
parent7dfdbf8fbebab9af95e19c5ff8af3073218e4a4f (diff)
- To make it easier for applications that want lots of magic stuff done on
redirections and thus cannot use CURLOPT_FOLLOWLOCATION easily, we now introduce the new CURLINFO_REDIRECT_URL option that lets applications extract the URL libcurl would've redirected to if it had been told to. This then enables the application to continue to that URL as it thinks is suitable, without having to re-implement the magic of creating the new URL from the Location: header etc. Test 1029 verifies it.
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r--lib/getinfo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c
index b3ef2f649..145a71b22 100644
--- a/lib/getinfo.c
+++ b/lib/getinfo.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, 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
@@ -231,6 +231,11 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
else
*param_longp = -1;
break;
+ case CURLINFO_REDIRECT_URL:
+ /* Return the URL this request would have been redirected to if that
+ option had been enabled! */
+ *param_charp = data->info.wouldredirect;
+ break;
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}