mattn/growl-for-linux — comment on commit 4497f346400f1e30e1e374819e22874a0cbd757f
File: plugins/from_url.c line 58
By yibe:

A header parsing problem occurs when `*ptr` stores more than one response header for one request. For example:
(`gntp-send t m 'http://bit.ly/uTQ47G'`)

HTTP/1.1 301 Moved
Server: nginx
Date: Tue, 25 Oct 2011 12:30:39 GMT
Content-Type: text/html; charset=utf-8 <======= Got
Connection: keep-alive
Set-Cookie: _bit=4ea6abef-003b6-05c96-3d1cf10a;domain=.bit.ly;expires=Sun Apr 22 12:30:39 2012;path=/; HttpOnly
Cache-control: private; max-age=90
Location: http://assets.github.com/images/gravatars/gravatar-140.png
MIME-Version: 1.0
Content-Length: 150 <======= Got

HTTP/1.1 200 OK
Server: nginx/1.0.4
Date: Tue, 25 Oct 2011 12:30:41 GMT
Content-Type: image/png <======= Expected
Content-Length: 1954 <======= Expected
Last-Modified: Fri, 04 Feb 2011 23:43:15 GMT
Connection: keep-alive
Expires: Wed, 24 Oct 2012 12:30:41 GMT
Cache-Control: max-age=31536000
Cache-Control: public
Accept-Ranges: bytes

The quickest fix might be to simply set the pointer after the second last `\r\n\r\n` if exists (perhaps also `\n\n`?), but I think it would be more secure to use `curl_easy_getinfo()` instead, unless there is a good reason not to rely on it. What do you think?