🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by sa Tue, 29 Jul 2008 18:52
urgent-help on indy
#21
Author: sa
Date: Tue, 29 Jul 2008 18:52
43 lines
1920 bytes
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 
Re: urgent-help on indy
#22
Author: Remy Lebeau (TeamB)
Date: Tue, 29 Jul 2008 19:35
35 lines
2359 bytes
"sa" <shaikakbar250281@yahoo.co.in> wrote in message 
news:488f6705@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 
Re: urgent-help on indy
#23
Author: sa
Date: Wed, 30 Jul 2008 13:52
25 lines
1661 bytes
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 
Re: urgent-help on indy
#24
Author: Remy Lebeau (TeamB)
Date: Wed, 30 Jul 2008 16:41
17 lines
1572 bytes
"sa" <shaikakbar250281@yahoo.co.in> wrote in message 
news:48907220@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 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads