Bo Berglund
2008-06-12 21:44:52 UTC
I am writing an application to retrieve TV program data from an
internet site. The owners of the site put some requirements on how the
site data are fetched and one of them is stated in the quote below:
<quote>
All http-requests must include a User-Agent value that is unique to
this particular version of the grabbing application. The User-Agent
shall consist of an alphanumeric string that is unique for the
program, followed by "/" and an alphanumeric versionnumber.
Optionally, more information may be added with a space after the
version-number followed by an arbitrary string.
</quote>
User-Agent in Indy TIdHTTP?
---------------------------
I am using the latest version of Indy 10 (snapshot downloaded about 2
weeks ago) with Delphi 7 Pro. I am using TIdHTTP with a
TIdCompressorZLib attached as Compressor (thanks for that tip, Remy!).
I don't know how to set the user agent thing with TIdHTTP and I don't
have any success searching the Indy 10 helpfile either...
So my first question is:
How can I code the TIdHTTP component to supply the requested
User-Agent information???
Caching and conditional GET?
----------------------------
They also request that the data are only downloaded once using some
kind of caching system. For a description of this they are pointing to
an URL where fetching of RSS feeds is described:
(http://fishbowl.pastiche.org/2002/10/21/http_conditional_get_for_rss_hackers)
However, I am not sure I understand what this site is saying and also
I don't know if it is at all possible to implement using Indy 10
components.
Basically I should be able to save the downloaded files in a cache
directory and not get them again if their dates have not changed on
the server. But then I need a mechanism to ask the server for the date
of the file and compare to my saved date for the file I have
downloaded before.
Questions:
How can one ask for the timestamp of a file on the server?
And how can one make a Conditional GET?
And is there a caching system already implemented among the many Indy
components that I can use for this particular project?
/BoB
internet site. The owners of the site put some requirements on how the
site data are fetched and one of them is stated in the quote below:
<quote>
All http-requests must include a User-Agent value that is unique to
this particular version of the grabbing application. The User-Agent
shall consist of an alphanumeric string that is unique for the
program, followed by "/" and an alphanumeric versionnumber.
Optionally, more information may be added with a space after the
version-number followed by an arbitrary string.
</quote>
User-Agent in Indy TIdHTTP?
---------------------------
I am using the latest version of Indy 10 (snapshot downloaded about 2
weeks ago) with Delphi 7 Pro. I am using TIdHTTP with a
TIdCompressorZLib attached as Compressor (thanks for that tip, Remy!).
I don't know how to set the user agent thing with TIdHTTP and I don't
have any success searching the Indy 10 helpfile either...
So my first question is:
How can I code the TIdHTTP component to supply the requested
User-Agent information???
Caching and conditional GET?
----------------------------
They also request that the data are only downloaded once using some
kind of caching system. For a description of this they are pointing to
an URL where fetching of RSS feeds is described:
(http://fishbowl.pastiche.org/2002/10/21/http_conditional_get_for_rss_hackers)
However, I am not sure I understand what this site is saying and also
I don't know if it is at all possible to implement using Indy 10
components.
Basically I should be able to save the downloaded files in a cache
directory and not get them again if their dates have not changed on
the server. But then I need a mechanism to ask the server for the date
of the file and compare to my saved date for the file I have
downloaded before.
Questions:
How can one ask for the timestamp of a file on the server?
And how can one make a Conditional GET?
And is there a caching system already implemented among the many Indy
components that I can use for this particular project?
/BoB