cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_HEADERFUNCTION with non-HTTP response ?

From: ruffnex <ruffnex_at_mac.com>
Date: Sat, 30 Nov 2002 12:28:11 +0800

Daniel,

Attached are patches & documentation to libcurl 7.10.2 to implement
CURLOPT_HTTP200ALIASES.

CURLOPT_HTTP200ALIASES

Pass a pointer to a linked list of aliases to be treated as a valid HTTP 200 response. Some servers respond with a custom header response line. For example, IceCast servers respond with "ICY 200 OK". By including this string in your list of aliases, the response will be treated as a valid HTTP header line such as "HTTP/1.0 200 OK". The HTTP response version is set according to CURLOPT_HTTP_VERSION. The linked list should be a fully valid list of struct curl_slist structs properly filled in. Use curl_slist_append(3) to create the list and curl_slist_free_all(3) to clean up an entire list.

Here is an example of setting the option:

// Try curling this ShoutCast server: http://205.188.234.65:8006
// With the alias, you can parse the HTTP headers after the response,
otherwise everything gets treated as body data
aliases = curl_slist_append( aliases, "ICY 200 OK" );
curl_easy_setopt( handle, CURLOPT_HTTP200ALIASES, aliases );

Hope we can use this is in next release.

Cheers,
Simon

On Tuesday, November 12, 2002, at 06:54 AM, Daniel Stenberg wrote:

> On Tue, 12 Nov 2002, ruffnex wrote:
>
>> Sounds good.
>>
>> The second method seems cleaner (for the s/w developer, no callbacks to
>> write) - just pass in a curl_slist of alternating strings & aliases, or
>> strings to be considered "HTTP 200 OK".
>>
>> Please let me know how you want to proceed.
>
> If you'd make a first attempt of implementing such a test in lib/transfer.
> c
> and post the code for it, then I'd be thrilled!
>
> Just make sure to check out a fairly recent version of that file, as
> changes
> have been made recently in the first-line checks (to fully detect and work
> with "HTTP" downloads that don't send headers!).
>
> --
> Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.

-------------------------------------------------------
This SF.net email is sponsored by: Get the new Palm Tungsten T
handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0002en

Received on 2002-11-30