summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-09-12 14:58:34 -0400
committerJune McEnroe <june@causal.agency>2019-09-12 14:58:34 -0400
commit9eff0ad61ee57045f4f569fecaf4b7e2d382f5e6 (patch)
tree33381613b4811483ac81082bd5be52019bf0cd0b
parentConsume entire body (diff)
downloadsrc-9eff0ad61ee57045f4f569fecaf4b7e2d382f5e6.tar.gz
src-9eff0ad61ee57045f4f569fecaf4b7e2d382f5e6.zip
Only GET the final redirect location
-rw-r--r--bin/title.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/title.c b/bin/title.c
index 11cb9fb7..47343d48 100644
--- a/bin/title.c
+++ b/bin/title.c
@@ -125,6 +125,11 @@ static CURLcode fetchTitle(const char *url) {
 	if (code) return code;
 	if (!type || strncmp(type, "text/html", 9)) return CURLE_OK;
 
+	char *dest;
+	curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &dest);
+	code = curl_easy_setopt(curl, CURLOPT_URL, dest);
+	if (code) return code;
+
 	body.len = 0;
 	title = false;
 	curl_easy_setopt(curl, CURLOPT_NOBODY, 0L);