From 78868962c03e5bdddad5c5d02c1d5a0c72a7ac26 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 28 Sep 2013 04:32:02 -0400 Subject: http: provide effective url to callers When we ask curl to access a URL, it may follow one or more redirects to reach the final location. We have no idea this has happened, as curl takes care of the details and simply returns the final content to us. The final URL that we ended up with can be accessed via CURLINFO_EFFECTIVE_URL. Let's make that optionally available to callers of http_get_*, so that they can make further decisions based on the redirection. Signed-off-by: Jeff King Signed-off-by: Jonathan Nieder --- http.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'http.h') diff --git a/http.h b/http.h index 17116abc57..974ede7736 100644 --- a/http.h +++ b/http.h @@ -133,6 +133,12 @@ struct http_get_options { /* If non-NULL, returns the content-type of the response. */ struct strbuf *content_type; + + /* + * If non-NULL, returns the URL we ended up at, including any + * redirects we followed. + */ + struct strbuf *effective_url; }; /* Return values for http_get_*() */ -- cgit v1.2.3