cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: patch for contenttype

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 29 Jan 2002 11:55:29 +0100 (MET)

On Tue, 29 Jan 2002, Giaslas Georgios wrote:

> i have attached a patch for curl-7.9.3 to get the content type of the last
> downloaded HTTP object.

[snip]

> Hope you add it to v.7.9.4

Many thanks! This is committed to the CVS now.

I did two minor tweaks:

o The CURLINFO_CONTENT_TYPE define should not re-use an existing info, as
  that breaks binary compatibility. It set it to CURLINFO_STRING + 18 now.

o The lib/transfer.c snippet used strlen() twice on the header, while it
  didn't do any real harm, it made the impression that it got the length of
  the content-type string which it of course didn't since a header can have
  more white space and it has a trailing CRLF. I modified that logic to
  parse the content-type string more explicitly. Have a look and feel free
  to comment.
[http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/curl/curl/lib/transfer.c.diff?r1=1.79&r2=1.80]

Can you also add some CURLINFO_CONTENT_TYPE docs to the
docs/curl_easy_getinfo.3 man page?

I am considering adding a curl_easy_setopt() option that tells curl to do
this "keep the content-type string" operation, and thus not always do it
unconditionally. Like how CURLOPT_FILETIME works already.

Anyone has any thoughts around how libcurl does things like this?

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2002-01-29