Permalink
Browse files

Set CURLOPT_FOLLOWLOCATION before grabbing the HTTP header, not after.

  • Loading branch information...
1 parent 8d1b0b5 commit bc267cb5ed27036edae3c66eb1270125f296eba0 @tm512 committed Mar 2, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/modules/linktitle/main.c
@@ -149,14 +149,14 @@ void linktitle (ircclient_t *cl, char *nick, char *host, char *source, char *mes
curl_easy_setopt (c, CURLOPT_WRITEHEADER, (void*) &head);
curl_easy_setopt (c, CURLOPT_WRITEDATA, (void*) &body);
curl_easy_setopt (c, CURLOPT_NOBODY, 1);
+ curl_easy_setopt (c, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_perform (c);
if (!strstr (head.data, "Content-Type: text/html"))
return; // According to the web server, this is not an HTML file
// Get the body of the http request
curl_easy_setopt (c, CURLOPT_HTTPGET, 1);
- curl_easy_setopt (c, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt (c, CURLOPT_WRITEHEADER, NULL);
curl_easy_perform (c);
curl_easy_cleanup (c);

0 comments on commit bc267cb

Please sign in to comment.