Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

urgent-help on indy

5 views
Skip to first unread message

sa

unread,
Jul 29, 2008, 2:52:52 PM7/29/08
to
Hello all.

I have a strange problem using TldHTTP component.

I am using BCB 6 and Indy 9.0.?? for communication.

1.My program has to download .xml, .jpg, .bmp files and store to the disk.

Code
-----
HTTP->Request->Pragma = "no-cache";
HTTP->HandleRedirects = true;
HTTP->ReadTimeout = 15000;

HTTP->Get(URL, FILEStream);

FILEStream->SaveToFile("C:\\test.xml");


Headers
---------
Accept = */*
AcceptEncoding = gzip, deflate
AcceptLanguage = en-us
Connection = Keep-Alive
ContectEncoding =
ContectLanguage =
ContectLength = -1
ContectRange = 0
ContectType =

With the same code and same request headers the program works fine with DSL
and Dialup connection. But failed with USB wireless internet connection.
Failed in the sense, after download xml file i see junk characters in the
file

Browser can able to display the files, i compared headers using HTTP packet
sniffer but no luck.

Please let me know if i need to provide more details.

Regards
SA


Remy Lebeau (TeamB)

unread,
Jul 29, 2008, 3:35:02 PM7/29/08
to

"sa" <shaikakb...@yahoo.co.in> wrote in message
news:488f...@newsgroups.borland.com...

> FILEStream->SaveToFile("C:\\test.xml");

Since you are downloading different types of files, you should use the
filename that the server sends back to you in the reply headers.

> AcceptEncoding = gzip, deflate

Indy 9 does not support those. You should not be specifying them in your
request header unless you are planning on decompressing the data manually if
the server compresses it. Otherwise, upgrade to Indy 10, which has a new
Compressor property in TIdHTTP to handle that.

> With the same code and same request headers the program works
> fine with DSL and Dialup connection. But failed with USB wireless
> internet connection. Failed in the sense, after download xml file i see
> junk characters in the file

The data is likely being compressed by the server, since your request
headers are saying that compression is allowed.

> Browser can able to display the files

The browser is decompressing the data.

> i compared headers using HTTP packet sniffer but no luck.

Does the "Content-Transfer-Encoding" reply header include "gzip" or
"deflate" in it? If so, then the data is compressed.


Gambit


sa

unread,
Jul 30, 2008, 9:52:54 AM7/30/08
to
Hi Remy

I get the point of compression.

1.What hapeens if the AcceptEncoding is left blank.

I mean, my target is acheive the latest files from the webserver whenever i
download. I have to prevent the caching, which is very very important for
me. For this i depend on Indy.

i have set pragma = no-cache;

2.What headers i should send in request, like the browsers do when Ctrl+F5
is pressed, to get the latest files from any server.

Because sometime i have this cache problem. I checked on the server-side,
there is no cache rule set.

I want to download files (.xml, .jpg, .bmp, .swf) which are less than 300
KB, nothing complicated, but i have only cache-problem.

What is the full-proff solution.

Regards
SA


Remy Lebeau (TeamB)

unread,
Jul 30, 2008, 12:41:52 PM7/30/08
to

"sa" <shaikakb...@yahoo.co.in> wrote in message
news:4890...@newsgroups.borland.com...

> What hapeens if the AcceptEncoding is left blank.

That tells the server that your client cannot accept any encoding of the
data, so it has to deliver it as-is.

> What headers i should send in request, like the browsers do
> when Ctrl+F5 is pressed, to get the latest files from any server.

You can use a packet sniffer, such as Ethereal/Wireshark, to see for
yourself.


Gambit


0 new messages